program Lustra; { 1 runda [B] 12.04.2014} const nmax=100000; type Ti=longint; TL=record w1,w2,h1,h2:Ti end; var t,n,i,wmin,wmax,hmin,hmax:Ti; wynik:boolean; L: array[1..nmax] of TL; begin readln(t); for t:=1 to t do begin wmin:=1000000000; wmax:=1; hmin:=1000000000; hmax:=1;//init readln(n); for i:=1 to n do with L[i] do //ustalanie majoranty begin readln(w1,w2,h1,h2); if w1<wmin then wmin:=w1; if w2>wmax then wmax:=w2; if h1<hmin then hmin:=h1; if h2>wmax then hmax:=h2 end;//majoranta = (wmin,wmax,hmin,hmax) wynik:=false; for i:=1 to n do with L[i] do begin //czy istnieje oferta = (wmin,wmax,hmin,hmax)? if w1=wmin then if w2=wmax then if h1=hmin then if h2=hmax then begin wynik:=true; break end //znaleziona oferta = majoranta end;//i if wynik then writeln('TAK') else writeln('NIE') end //t end.
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 | program Lustra; { 1 runda [B] 12.04.2014} const nmax=100000; type Ti=longint; TL=record w1,w2,h1,h2:Ti end; var t,n,i,wmin,wmax,hmin,hmax:Ti; wynik:boolean; L: array[1..nmax] of TL; begin readln(t); for t:=1 to t do begin wmin:=1000000000; wmax:=1; hmin:=1000000000; hmax:=1;//init readln(n); for i:=1 to n do with L[i] do //ustalanie majoranty begin readln(w1,w2,h1,h2); if w1<wmin then wmin:=w1; if w2>wmax then wmax:=w2; if h1<hmin then hmin:=h1; if h2>wmax then hmax:=h2 end;//majoranta = (wmin,wmax,hmin,hmax) wynik:=false; for i:=1 to n do with L[i] do begin //czy istnieje oferta = (wmin,wmax,hmin,hmax)? if w1=wmin then if w2=wmax then if h1=hmin then if h2=hmax then begin wynik:=true; break end //znaleziona oferta = majoranta end;//i if wynik then writeln('TAK') else writeln('NIE') end //t end. |