#include <iostream> using namespace std; unsigned long int dupa[100000*4]; #define MAX_INT 1000000001 int main() { int testCases; cin >> testCases; while ( testCases-- ) { unsigned long int minX = MAX_INT, minY = MAX_INT, maxX = 0, maxY = 0; long int factoryCount; cin >> factoryCount; long int index = 0; for ( int i = 0; i < factoryCount; ++i ) { cin >> dupa[4*i] >> dupa[4*i+1] >> dupa[4*i+2] >> dupa[4*i+3]; if ( dupa[4*i] < minX ) { index = i; minX = dupa[4*i]; } if ( dupa[4*i+1] > maxX ) { index = i; maxX = dupa[4*i+1]; } if ( dupa[4*i+2] < minY ) { index = i; minY = dupa[4*i+2]; } if ( dupa[4*i+3] > maxY ) { index = i; maxY = dupa[4*i+3]; } } if ( minX == dupa[4*index] && maxX == dupa[4*index+1] && minY == dupa[4*index+2] && maxY == dupa[4*index+3] ) cout << "TAK" << endl; else cout << "NIE" << endl; } 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 <iostream> using namespace std; unsigned long int dupa[100000*4]; #define MAX_INT 1000000001 int main() { int testCases; cin >> testCases; while ( testCases-- ) { unsigned long int minX = MAX_INT, minY = MAX_INT, maxX = 0, maxY = 0; long int factoryCount; cin >> factoryCount; long int index = 0; for ( int i = 0; i < factoryCount; ++i ) { cin >> dupa[4*i] >> dupa[4*i+1] >> dupa[4*i+2] >> dupa[4*i+3]; if ( dupa[4*i] < minX ) { index = i; minX = dupa[4*i]; } if ( dupa[4*i+1] > maxX ) { index = i; maxX = dupa[4*i+1]; } if ( dupa[4*i+2] < minY ) { index = i; minY = dupa[4*i+2]; } if ( dupa[4*i+3] > maxY ) { index = i; maxY = dupa[4*i+3]; } } if ( minX == dupa[4*index] && maxX == dupa[4*index+1] && minY == dupa[4*index+2] && maxY == dupa[4*index+3] ) cout << "TAK" << endl; else cout << "NIE" << endl; } return 0; } |