#include <iostream> #include <utility> #include <vector> #define INF 1000000000 using namespace std; pair<long long, long long> ver, hor; struct Size{ long long verMin; long long verMax; long long horMin; long long horMax; }tab[100001]; void wyzeruj(){ ver.first = INF; ver.second = 0; hor.first = INF; hor.second = 0; } int main() { ios_base::sync_with_stdio(false); long long vMin, vMax, hMin, hMax; int n; cin >> n; while(n--){ int m; cin >> m; wyzeruj(); for(int i = 0; i < m; i++){ //int fl = 0; //cin >> vMin >> vMax >> hMin >> hMax; cin >> tab[i].verMin >> tab[i].verMax >> tab[i].horMin >> tab[i].horMax; if(tab[i].verMin < ver.first) { //fl++; ver.first = tab[i].verMin; } if(tab[i].verMax > ver.second){ //fl++; ver.second = tab[i].verMax; } if(tab[i].horMin < hor.first){ //fl++; hor.first = tab[i].horMin; } if(tab[i].horMax > hor.second) { //fl++; hor.second = tab[i].horMax; } //if(fl == 4 || fl == 0) flag = true; //else if(fl > 0) flag = false; } //if(flag) cout << "\ntak"; //else cout << "\nnie"; for(int i = 0; i <= m; i++){ if(i == m){cout << "NIE\n"; break;} if(tab[i].verMin == ver.first && tab[i].verMax == ver.second && tab[i].horMin == hor.first && tab[i].horMax == hor.second){ cout << "TAK\n"; break; } } } 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #include <iostream> #include <utility> #include <vector> #define INF 1000000000 using namespace std; pair<long long, long long> ver, hor; struct Size{ long long verMin; long long verMax; long long horMin; long long horMax; }tab[100001]; void wyzeruj(){ ver.first = INF; ver.second = 0; hor.first = INF; hor.second = 0; } int main() { ios_base::sync_with_stdio(false); long long vMin, vMax, hMin, hMax; int n; cin >> n; while(n--){ int m; cin >> m; wyzeruj(); for(int i = 0; i < m; i++){ //int fl = 0; //cin >> vMin >> vMax >> hMin >> hMax; cin >> tab[i].verMin >> tab[i].verMax >> tab[i].horMin >> tab[i].horMax; if(tab[i].verMin < ver.first) { //fl++; ver.first = tab[i].verMin; } if(tab[i].verMax > ver.second){ //fl++; ver.second = tab[i].verMax; } if(tab[i].horMin < hor.first){ //fl++; hor.first = tab[i].horMin; } if(tab[i].horMax > hor.second) { //fl++; hor.second = tab[i].horMax; } //if(fl == 4 || fl == 0) flag = true; //else if(fl > 0) flag = false; } //if(flag) cout << "\ntak"; //else cout << "\nnie"; for(int i = 0; i <= m; i++){ if(i == m){cout << "NIE\n"; break;} if(tab[i].verMin == ver.first && tab[i].verMax == ver.second && tab[i].horMin == hor.first && tab[i].horMax == hor.second){ cout << "TAK\n"; break; } } } return 0; } |