#include <iostream>
#include <set>
using namespace std;
int main() {
int t, n;
int w1,w2,h1,h2;
int min = 1000000001;
int max = 0;
set<int> zbior_major;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> n;
for (int j = 0; j < n; j++)
{
cin >> w1 >> w2 >> h1 >> h2;
if (w2*h2 >= max)
{
if (w2*h2 > max)
{
max = w2*h2;
zbior_major.clear();
}
if (w1*h1 <= min)
{
if (w1*h1 < min)
{
min = w1*h1;
zbior_major.clear();
}
zbior_major.insert(j);
}
}
if (w1*h1 < min)
{
zbior_major.clear();
}
}
min = 1000000001;
max = 0;
if (zbior_major.size() >= 1) cout << "TAK" << endl;
else cout << "NIE" << endl;
zbior_major.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 | #include <iostream> #include <set> using namespace std; int main() { int t, n; int w1,w2,h1,h2; int min = 1000000001; int max = 0; set<int> zbior_major; cin >> t; for (int i = 0; i < t; i++) { cin >> n; for (int j = 0; j < n; j++) { cin >> w1 >> w2 >> h1 >> h2; if (w2*h2 >= max) { if (w2*h2 > max) { max = w2*h2; zbior_major.clear(); } if (w1*h1 <= min) { if (w1*h1 < min) { min = w1*h1; zbior_major.clear(); } zbior_major.insert(j); } } if (w1*h1 < min) { zbior_major.clear(); } } min = 1000000001; max = 0; if (zbior_major.size() >= 1) cout << "TAK" << endl; else cout << "NIE" << endl; zbior_major.clear(); } return 0; } |
English