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
#include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
using namespace std;
main()
{int T,k,w1[k],w2[k],h1[k],h2[k],a=999999999,b=0,c=999999999,d=0;
cin>>T;
for(int i=0; i<T; i++)
      {cin>>k;
       for (int j=0; j<k; j++)
            {cin>>w1[j]>>w2[j]>>h1[j]>>h2[j];
                if(w1[j]<=a && w2[j]>=b && h1[j]<=c && h2[j]>=d)
                                                     { a=w1[j];  b=w2[j]; c=h1[j]; d=h2[j];
                                                      }
                           else if (w1[j]<a || w2[j]>b || h1[j]<c || h2[j]>d) cout<<"NIE"<<endl;
                           }
             cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl;
             for (int j=0; j<k; j++)
             {if(w1[j]==a && w2[j]==b && h1[j]==c && h2[j]==d) cout<<"tak"<<endl;
               else  (cout<<"nie"<<endl);
            }}
             system("pause");
             return 0;
             }