标签:less std poj class col div puts color bre
#include <cstdio> #include <cstring> #include <string> #include <vector> #include <queue> #include <algorithm> #include <iostream> using namespace std; int main() { int t; int n,m; int num1[2010]; int num2[2010]; priority_queue<int,deque<int>,less<int> > big; scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); for(int i=0;i<n;i++) scanf("%d",&num1[i]); sort(num1,num1+n); for(int i=1;i<m;i++) { for(int j=0;j<n;j++) { scanf("%d",&num2[j]); big.push(num1[0]+num2[j]); } sort(num2,num2+n); for(int k=1;k<n;k++) for(int l=0;l<n;l++) { if(num1[k]+num2[l]>big.top()) break; big.pop(); big.push(num1[k]+num2[l]); } for(int k=0;k<n;k++) { num1[n-k-1]=big.top(); big.pop(); } } printf("%d",num1[0]); for(int i=1;i<n;i++) printf(" %d",num1[i]); puts(""); } }
标签:less std poj class col div puts color bre
原文地址:https://www.cnblogs.com/zsben991126/p/10246626.html