#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector < int > Wp;
vector < int > Wq;
vector < int > Hp;
vector < int > Hq;
int t, n, p1, p2, q1, q2;
int min1, min2, max1, max2;
int main()
{
ios::sync_with_stdio(0);
cin >> t;
while(t--)
{
min1 = min2 = 10000000001;
max1 = max2 = -1;
bool ans = false;
cin >> n;
for(int i=0; i<n; i++)
{
cin >> p1 >> q1 >> p2 >> q2;
Wp.push_back(p1);
Wq.push_back(q1);
Hp.push_back(p2);
Hq.push_back(q2);
min1 = min(min1, p1);
min2 = min(min2, p2);
max1 = max(max1, q1);
max2 = max(max2, q2);
}
for(int i=1; i<n; i++)
{
if(min1 == Wp[i] && min2 == Hp[i] && max1 == Wq[i] && max2 == Hq[i])
ans = true;
}
if(ans) cout << "TAK\n";
else cout << "NIE\n";
Wp.clear();
Wq.clear();
Hp.clear();
Hq.clear();
}
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 | #include <iostream> #include <vector> #include <algorithm> using namespace std; vector < int > Wp; vector < int > Wq; vector < int > Hp; vector < int > Hq; int t, n, p1, p2, q1, q2; int min1, min2, max1, max2; int main() { ios::sync_with_stdio(0); cin >> t; while(t--) { min1 = min2 = 10000000001; max1 = max2 = -1; bool ans = false; cin >> n; for(int i=0; i<n; i++) { cin >> p1 >> q1 >> p2 >> q2; Wp.push_back(p1); Wq.push_back(q1); Hp.push_back(p2); Hq.push_back(q2); min1 = min(min1, p1); min2 = min(min2, p2); max1 = max(max1, q1); max2 = max(max2, q2); } for(int i=1; i<n; i++) { if(min1 == Wp[i] && min2 == Hp[i] && max1 == Wq[i] && max2 == Hq[i]) ans = true; } if(ans) cout << "TAK\n"; else cout << "NIE\n"; Wp.clear(); Wq.clear(); Hp.clear(); Hq.clear(); } return 0; } |
English