标签:panel etc dev includes ++ style sar its lap
1 #include <iostream> 2 using namespace std; 3 #include<string.h> 4 #include<set> 5 #include<stdio.h> 6 #include<math.h> 7 #include<queue> 8 #include<map> 9 #include<algorithm> 10 #include<queue> 11 #define ll long long 12 int t,n,l,r,d,b,c; 13 struct lll 14 { 15 int wendu,chazhi; 16 bool operator<(const lll &qwe)const 17 { 18 return wendu<qwe.wendu; 19 } 20 }a[100100]; 21 22 int main() 23 { 24 scanf("%d",&t); 25 while(t--) 26 { 27 scanf("%d",&n); 28 long long max1=0,sum=0;int add=0; 29 for(int i=1;i<=n;++i) 30 { 31 scanf("%d%d%d%d%d",&l,&r,&d,&b,&c); 32 sum+=c; 33 a[++add].wendu=l*2; 34 a[add].chazhi=d-c; 35 a[++add].wendu=r*2+1; 36 a[add].chazhi=b-d; 37 } 38 max1=sum; 39 sort(a+1,a+1+add); 40 int i; 41 for(i=1;i<=add;) 42 { 43 sum+=a[i].chazhi; 44 i++; 45 while(a[i].wendu==a[i-1].wendu) 46 { 47 sum+=a[i].chazhi; 48 i++; 49 } 50 max1=max(max1,sum); 51 } 52 cout<<max1<<endl; 53 } 54 }
InputThe input includes multiple test cases. The first line contains a single integer TT, the number of test cases.
The first line of each test case contains a single integer n∈[1,50000]n∈[1,50000], the number of potted plants.
The next nn line, each line contains five integers li,ri,ai,bi,ci∈[1,109]li,ri,ai,bi,ci∈[1,109].
OutputFor each test case, print one line of one single integer presenting the answer.
Sample Input
1 5 5 8 16 20 12 10 16 3 13 13 8 11 13 1 11 7 9 6 17 5 2 11 20 8 5
Sample Output
83
超时的一天 看了别人的才写出来
Lotus and Horticulture HDU - 6012
标签:panel etc dev includes ++ style sar its lap
原文地址:http://www.cnblogs.com/dulute/p/7272707.html