bzoj3715: [PA2014]Lustra(乱搞)

3715: [PA2014]Lustra

题目:传送门 


题解:

   随手一发水题x1

   随便排序一下...小学生题???

    


代码:

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<cstdlib>
 4 #include<cmath>
 5 #include<algorithm>
 6 using namespace std;
 7 struct node
 8 {
 9     int w1,w2,h1,h2;
10 }a[110000];
11 int T,n;
12 bool cmp(node n1,node n2)
13 {
14     if(n1.w2!=n2.w2)return n1.w2<n2.w2;
15     if(n1.w1!=n2.w1)return n1.w1>n2.w1;
16     if(n1.h2!=n2.h2)return n1.h2<n2.h2;
17     if(n1.h1!=n2.h1)return n1.h1>n2.h1;
18     return false;
19 }
20 int main()
21 {
22     scanf("%d",&T);
23     while(T--)
24     {
25         scanf("%d",&n);
26         for(int i=1;i<=n;i++)scanf("%d%d%d%d",&a[i].w1,&a[i].w2,&a[i].h1,&a[i].h2);
27         sort(a+1,a+n+1,cmp);int wo=a[n].w1,wt=a[n].w2,ho=a[n].h1,ht=a[n].h2;bool bk=true;
28         for(int i=1;i<n;i++)if(wo>a[i].w1 || wt<a[i].w2 || ho>a[i].h1 || ht<a[i].h2){bk=false;break;}
29         if(bk==true)printf("TAK
");
30         else printf("NIE
");
31     }
32     return 0;
33 }
原文地址:https://www.cnblogs.com/CHerish_OI/p/8688098.html