Unfortunately we were unable to fully decode your file, as it is not encoded in UTF-8. You can try to decode it yourself by downloading it here.
 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
#include <iostream>
using namespace std;
int t;   // ile przypadk�w
long n;  // 2 - 100 000 ile zakladow
long minw, maxw, minh, maxh;
long w1, w2, h1, h2;
bool jestmajor;
bool zawarty();
bool majoryzuje();

int main()
{
    ios_base::sync_with_stdio(0);
    cin>>t;
    for(int it=0; it<t; it++)
    {
        cin>>n;
        cin>>minw; cin>>maxw;         //1-szy zaklad
        cin>>minh; cin>>maxh;
        jestmajor=true;               //------------              
        
        for(long i=2; i<=n; i++)
        {
            cin>>w1; cin>>w2; cin>>h1; cin>>h2;
            if((jestmajor and !zawarty()) or !jestmajor)
            {
                if(majoryzuje()) jestmajor=true; else jestmajor=false;
                if(w1<minw) minw=w1; if(w2>maxw) maxw=w2;
                if(h1<minh) minh=h1; if(h2>maxh) maxh=h2;
            }           
        }
        if(jestmajor) cout<<"TAK"; else cout<<"NIE"; cout<<endl;
    }
    return 0; 
}

bool zawarty()
{
    return((w1>=minw) and (w2<=maxw) and 
           (h1>=minh) and (h2<=maxh));
}

bool majoryzuje()
{
    return((w1<=minw) and (w2>=maxw) and (h1<=minh) and (h2>=maxh));
}