#include <cstdio>
#include<algorithm>
using namespace std;
int t, n, minszer, maxszer, minwys, maxwys;
int wiel[100005][4];
int main()
{
scanf("%d", &t);
for (int z=0; z<t; z++)
{
scanf("%d", &n);
scanf("%d%d%d%d", &wiel[0][0], &wiel[0][1], &wiel[0][2], &wiel[0][3]);
minszer=wiel[0][0];
maxszer=wiel[0][1];
minwys=wiel[0][2];
maxwys=wiel[0][3];
for (int i=1; i<n; i++)
{
scanf("%d%d%d%d", &wiel[i][0], &wiel[i][1], &wiel[i][2], &wiel[i][3]);
minszer=min(minszer,wiel[i][0]);
maxszer=max(maxszer,wiel[i][1]);
minwys=min(minwys,wiel[i][2]);
maxwys=max(maxwys,wiel[i][3]);
}
//printf("%d %d %d %d\n", minszer, maxszer, minwys, maxwys);
int i;
for (i=0; i<n; i++)
{
if (wiel[i][0]==minszer&&wiel[i][1]==maxszer&&wiel[i][2]==minwys&&wiel[i][3]==maxwys)
{printf("TAK\n"); i = n+5;}
}
if (i<n+5)
{
printf("NIE\n");
}
}
return 0;
}
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 | #include <cstdio> #include<algorithm> using namespace std; int t, n, minszer, maxszer, minwys, maxwys; int wiel[100005][4]; int main() { scanf("%d", &t); for (int z=0; z<t; z++) { scanf("%d", &n); scanf("%d%d%d%d", &wiel[0][0], &wiel[0][1], &wiel[0][2], &wiel[0][3]); minszer=wiel[0][0]; maxszer=wiel[0][1]; minwys=wiel[0][2]; maxwys=wiel[0][3]; for (int i=1; i<n; i++) { scanf("%d%d%d%d", &wiel[i][0], &wiel[i][1], &wiel[i][2], &wiel[i][3]); minszer=min(minszer,wiel[i][0]); maxszer=max(maxszer,wiel[i][1]); minwys=min(minwys,wiel[i][2]); maxwys=max(maxwys,wiel[i][3]); } //printf("%d %d %d %d\n", minszer, maxszer, minwys, maxwys); int i; for (i=0; i<n; i++) { if (wiel[i][0]==minszer&&wiel[i][1]==maxszer&&wiel[i][2]==minwys&&wiel[i][3]==maxwys) {printf("TAK\n"); i = n+5;} } if (i<n+5) { printf("NIE\n"); } } return 0; } |
English