bzoj3715: [PA2014]Lustra(乱搞)

本文介绍了一个简单的编程题——PA2014 Lustra,并提供了一种通过排序来解决问题的方法。该题要求检查是否有一个矩形能够完全覆盖其他所有矩形。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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\n");
30         else printf("NIE\n");
31     }
32     return 0;
33 }

 

转载于:https://www.cnblogs.com/CHerish_OI/p/8688098.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值