#include <iostream> using namespace std; int main(int argc, char *argv[]) { int t, n; cin >> t; for (int l=0; l<t; l++) { int width = 0, height = 0, pom_width = 0, pom_height = 0, over = 0; cin >> n; int mirror[n][4]; for (int i=0; i<n; i++) { for (int j=0; j<4; j++) { cin >> mirror[i][j]; } } width = mirror[0][1] - mirror[0][0]; height = mirror[0][3] - mirror[0][2]; for (int i=1; i<n; i++) { if (mirror[i][1]-mirror[i][0] > width) { width = mirror[i][1] - mirror[i][0]; pom_width = i; } if (mirror[i][3] - mirror[i][2] > height) { height = mirror[i][3] - mirror[i][2]; pom_height = i; } if(width == mirror[i][1] - mirror[i][0] && height == mirror[i][3] - mirror[i][2]) { over++; } } if (((pom_width != -1 && pom_height != -1) && (pom_height == pom_width) ) && over < n - 1) { cout << "TAK\n"; } else { cout << "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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include <iostream> using namespace std; int main(int argc, char *argv[]) { int t, n; cin >> t; for (int l=0; l<t; l++) { int width = 0, height = 0, pom_width = 0, pom_height = 0, over = 0; cin >> n; int mirror[n][4]; for (int i=0; i<n; i++) { for (int j=0; j<4; j++) { cin >> mirror[i][j]; } } width = mirror[0][1] - mirror[0][0]; height = mirror[0][3] - mirror[0][2]; for (int i=1; i<n; i++) { if (mirror[i][1]-mirror[i][0] > width) { width = mirror[i][1] - mirror[i][0]; pom_width = i; } if (mirror[i][3] - mirror[i][2] > height) { height = mirror[i][3] - mirror[i][2]; pom_height = i; } if(width == mirror[i][1] - mirror[i][0] && height == mirror[i][3] - mirror[i][2]) { over++; } } if (((pom_width != -1 && pom_height != -1) && (pom_height == pom_width) ) && over < n - 1) { cout << "TAK\n"; } else { cout << "NIE\n"; } } return 0; } |