/* * ===================================================================================== * * Filename: main.cpp * * Description: * * Version: 1.0 * Created: 12.05.2014 14:20:31 * Revision: none * Compiler: gcc * * Author: YOUR NAME (), * Organization: * * ===================================================================================== */ #include <iostream> #include <vector> #define REP(a, b) for(int a=0; a<(b); a++) using namespace std; int testy; int n = 0; struct PAIR{ PAIR(int _MinW, int _MaxW, int _MinH, int _MaxH){ MinW = _MinW; MaxW = _MaxW; MinH = _MinH; MaxH = _MaxH; }; int MinW, MaxW, MinH, MaxH; }; vector<PAIR>T; int main() { ios_base::sync_with_stdio(0); int MinH = -1, MinW = -1, MaxH = -1, MaxW = -1; cin >> testy; bool flaga = false; while(testy--) { T.clear(); flaga = false; cin >> n; REP(i, n) { cin >> MinW >> MaxW >> MinH >> MaxH; PAIR tmp(MinW, MaxW, MinH, MaxH); T.push_back(tmp); } REP(i, n) { MinW = min(MinW, T[i].MinW); MinH = min(MinH, T[i].MinH); MaxW = max(MaxW, T[i].MaxW); MaxH = max(MaxH, T[i].MaxH); } REP(i, n) { if(T[i].MinW <= MinW && T[i].MaxW >= MaxW && T[i].MinH <= MinH && T[i].MaxH >= MaxH){ flaga = true; } } if(flaga) 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | /* * ===================================================================================== * * Filename: main.cpp * * Description: * * Version: 1.0 * Created: 12.05.2014 14:20:31 * Revision: none * Compiler: gcc * * Author: YOUR NAME (), * Organization: * * ===================================================================================== */ #include <iostream> #include <vector> #define REP(a, b) for(int a=0; a<(b); a++) using namespace std; int testy; int n = 0; struct PAIR{ PAIR(int _MinW, int _MaxW, int _MinH, int _MaxH){ MinW = _MinW; MaxW = _MaxW; MinH = _MinH; MaxH = _MaxH; }; int MinW, MaxW, MinH, MaxH; }; vector<PAIR>T; int main() { ios_base::sync_with_stdio(0); int MinH = -1, MinW = -1, MaxH = -1, MaxW = -1; cin >> testy; bool flaga = false; while(testy--) { T.clear(); flaga = false; cin >> n; REP(i, n) { cin >> MinW >> MaxW >> MinH >> MaxH; PAIR tmp(MinW, MaxW, MinH, MaxH); T.push_back(tmp); } REP(i, n) { MinW = min(MinW, T[i].MinW); MinH = min(MinH, T[i].MinH); MaxW = max(MaxW, T[i].MaxW); MaxH = max(MaxH, T[i].MaxH); } REP(i, n) { if(T[i].MinW <= MinW && T[i].MaxW >= MaxW && T[i].MinH <= MinH && T[i].MaxH >= MaxH){ flaga = true; } } if(flaga) cout << "TAK\n"; else cout << "NIE\n"; } return 0; } |