1. 程式人生 > >BZOJ3715: [PA2014]Lustra

BZOJ3715: [PA2014]Lustra

bsp ext pos lan class truct clas AC -a

【傳送門:BZOJ4034】


簡要題意:

  給出n個工廠,並給出每個工廠可以生產的鏡子的最大、最小寬度和最大、最小高度

  判斷是否存在一個工廠能夠生產出其他工廠能夠生產的鏡子


題解:

  水題,直接排序,然後判斷是否存在不合理情況就行了


參考代碼:

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
struct node
{
    
int w1,w2,h1,h2; }a[110000]; bool cmp(node n1,node n2) { if(n1.w1<n2.w1) return true; if(n1.w1>n2.w1) return false; if(n1.w2>n2.w2) return true; if(n1.w2<n2.w2) return false; if(n1.h1<n2.h1) return true; if(n1.h1>n2.h1) return false; if(n1.h2>n2.h2) return
true; if(n1.h2<n2.h2) return false; return false; } int main() { int T; scanf("%d",&T); while(T--) { int n;scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d%d%d%d",&a[i].w1,&a[i].w2,&a[i].h1,&a[i].h2); sort(a+1,a+n+1
,cmp); bool bk=true; for(int i=2;i<=n;i++) { if(a[i].w1<a[1].w1||a[i].w2>a[1].w2||a[i].h1<a[1].h1||a[i].h2>a[1].h2) { bk=false; break; } } if(bk==true) printf("TAK\n"); else printf("NIE\n"); } return 0; }

BZOJ3715: [PA2014]Lustra