#include <iostream>
#include <vector>
int main()
{
unsigned testCases;
std::vector<bool> result;
std::cin>>testCases;
for(unsigned i=0;i<testCases;i++)
{
unsigned companies;
std::cin>>companies;
bool filled=1;
unsigned int wm,wx,hm,hx;
unsigned int w1,w2,h1,h2;
std::cin>>wm>>wx>>hm>>hx;
for(int j=1;j<companies;j++)
{
std::cin>>w1>>w2>>h1>>h2;
if(w1<wm||w2>wx||h1<hm||h2>hx)
{
if(w1<=wm&&w2>=wx&&h1<=hm&&h2>=hx)
filled=1;
else
filled=0;
wm=std::min(w1,wm);
wx=std::max(w2,wx);
hm=std::min(h1,hm);
hx=std::max(h2,hx);
}
}
result.push_back(filled);
}
for(std::vector<bool>::iterator it=result.begin();
it!=result.end();
it++)
std::cout<<((*it)?"TAK":"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 | #include <iostream> #include <vector> int main() { unsigned testCases; std::vector<bool> result; std::cin>>testCases; for(unsigned i=0;i<testCases;i++) { unsigned companies; std::cin>>companies; bool filled=1; unsigned int wm,wx,hm,hx; unsigned int w1,w2,h1,h2; std::cin>>wm>>wx>>hm>>hx; for(int j=1;j<companies;j++) { std::cin>>w1>>w2>>h1>>h2; if(w1<wm||w2>wx||h1<hm||h2>hx) { if(w1<=wm&&w2>=wx&&h1<=hm&&h2>=hx) filled=1; else filled=0; wm=std::min(w1,wm); wx=std::max(w2,wx); hm=std::min(h1,hm); hx=std::max(h2,hx); } } result.push_back(filled); } for(std::vector<bool>::iterator it=result.begin(); it!=result.end(); it++) std::cout<<((*it)?"TAK":"NIE")<<'\n'; return 0; } |
English