#include<stdio.h> #include <stdlib.h> main() { int ilosc; int* vector = (int*)malloc(sizeof(int)*4); int* vector2 = (int*)malloc(sizeof(int)*4); scanf("%d",&ilosc); for (int i = 0; i < ilosc; i++) { int jeden_test; scanf("%d",&jeden_test); int yes = 1; for (int j=0; j<jeden_test;j++) { if (j==0) { scanf("%d",vector); scanf("%d",vector+1); scanf("%d",vector+2); scanf("%d",vector+3); continue; } scanf("%d",vector2); scanf("%d",vector2+1); scanf("%d",vector2+2); scanf("%d",vector2+3); if (vector2[0] >= vector[0] and vector2[1] <= vector[1] and vector2[2] >= vector[2] and vector2[3] <= vector[3]) { continue; } yes = 0; if (vector2[0] <= vector[0] and vector2[1] >= vector[1] and vector2[2] <= vector[2] and vector2[3] >= vector[3]) { yes = 1; } if (vector2[0] < vector[0]){vector[0] = vector2[0];} if (vector2[1] > vector[1]){vector[1] = vector2[1];} if (vector2[2] < vector[2]){vector[2] = vector2[2];} if (vector2[3] > vector[3]){vector[3] = vector2[3];} } yes ? printf("TAK\n") : 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 39 40 41 | #include<stdio.h> #include <stdlib.h> main() { int ilosc; int* vector = (int*)malloc(sizeof(int)*4); int* vector2 = (int*)malloc(sizeof(int)*4); scanf("%d",&ilosc); for (int i = 0; i < ilosc; i++) { int jeden_test; scanf("%d",&jeden_test); int yes = 1; for (int j=0; j<jeden_test;j++) { if (j==0) { scanf("%d",vector); scanf("%d",vector+1); scanf("%d",vector+2); scanf("%d",vector+3); continue; } scanf("%d",vector2); scanf("%d",vector2+1); scanf("%d",vector2+2); scanf("%d",vector2+3); if (vector2[0] >= vector[0] and vector2[1] <= vector[1] and vector2[2] >= vector[2] and vector2[3] <= vector[3]) { continue; } yes = 0; if (vector2[0] <= vector[0] and vector2[1] >= vector[1] and vector2[2] <= vector[2] and vector2[3] >= vector[3]) { yes = 1; } if (vector2[0] < vector[0]){vector[0] = vector2[0];} if (vector2[1] > vector[1]){vector[1] = vector2[1];} if (vector2[2] < vector[2]){vector[2] = vector2[2];} if (vector2[3] > vector[3]){vector[3] = vector2[3];} } yes ? printf("TAK\n") : printf("NIE\n"); } return (0); } |