#include <cstdio>
#include <utility>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int q;
scanf("%d", &q);
while(q--){
int n;
scanf("%d", &n);
pair<pair<int,int>, pair<int,int> > of[n+5];
int maxh1=1000000000, maxh2=0, maxw1=1000000000, maxw2=0;
for(int i=0;i<n;i++){
int h1,h2,w1,w2;
scanf("%d%d%d%d", &h1,&h2,&w1,&w2);
of[i].first.first=h1;
of[i].first.second=h2;
of[i].second.first=w1;
of[i].second.second=w2;
maxh1=min(maxh1, h1);
maxh2=max(maxh2, h2);
maxw1=min(maxw1, w1);
maxw2=max(maxw2, w2);
}
bool czy=false;
for(int i=0;i<n;i++){
if(of[i].first.first==maxh1 && of[i].first.second==maxh2 && of[i].second.first==maxw1 && of[i].second.second==maxw2){
printf("TAK\n");
czy=true;
break;
}
}
if(!czy){
printf("NIE\n");
}
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include <cstdio> #include <utility> #include <string> #include <algorithm> using namespace std; int main(){ int q; scanf("%d", &q); while(q--){ int n; scanf("%d", &n); pair<pair<int,int>, pair<int,int> > of[n+5]; int maxh1=1000000000, maxh2=0, maxw1=1000000000, maxw2=0; for(int i=0;i<n;i++){ int h1,h2,w1,w2; scanf("%d%d%d%d", &h1,&h2,&w1,&w2); of[i].first.first=h1; of[i].first.second=h2; of[i].second.first=w1; of[i].second.second=w2; maxh1=min(maxh1, h1); maxh2=max(maxh2, h2); maxw1=min(maxw1, w1); maxw2=max(maxw2, w2); } bool czy=false; for(int i=0;i<n;i++){ if(of[i].first.first==maxh1 && of[i].first.second==maxh2 && of[i].second.first==maxw1 && of[i].second.second==maxw2){ printf("TAK\n"); czy=true; break; } } if(!czy){ printf("NIE\n"); } } } |
English