Niestety, nie byliśmy w stanie w pełni poprawnie wyświetlić tego pliku, ponieważ nie jest zakodowany w UTF-8.
Możesz pobrać ten plik i spróbować otworzyć go samodzielnie.
#include <cstdio> #include <algorithm> using namespace std; class square { int w1, w2, h1, h2; public: square () {} square (int _w1, int _w2, int _h1, int _h2) : w1(_w1), w2(_w2), h1(_h1), h2(_h2) {} inline bool operator== (square &b) { return w1==b.w1 && w2==b.w2 && h1==b.h1 && h2==b.h2; } inline bool operator<= (square &b) { // czy this mie�ci si� w b? return (*this + b) == b; } inline square operator+ (const square &b) { return square (min(w1, b.w1), max(w2, b.w2), min(h1, b.h1), max(h2, b.h2)); } inline square& operator= (const square &b) { w1 = b.w1; w2 = b.w2; h1 = b.h1; h2 = b.h2; return *this; } inline square& read () { scanf ("%d%d%d%d", &w1, &w2, &h1, &h2); return *this; } }; int main () { int t, n; square view, curr, largest; scanf ("%d", &t); while (t--){ scanf ("%d", &n); largest = view = curr.read (); while (--n){ view = view + curr.read (); if (largest <= curr) largest = curr; } printf ("%s\n", (view == largest? "TAK" : "NIE")); } }
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 49 50 | #include <cstdio> #include <algorithm> using namespace std; class square { int w1, w2, h1, h2; public: square () {} square (int _w1, int _w2, int _h1, int _h2) : w1(_w1), w2(_w2), h1(_h1), h2(_h2) {} inline bool operator== (square &b) { return w1==b.w1 && w2==b.w2 && h1==b.h1 && h2==b.h2; } inline bool operator<= (square &b) { // czy this mie�ci si� w b? return (*this + b) == b; } inline square operator+ (const square &b) { return square (min(w1, b.w1), max(w2, b.w2), min(h1, b.h1), max(h2, b.h2)); } inline square& operator= (const square &b) { w1 = b.w1; w2 = b.w2; h1 = b.h1; h2 = b.h2; return *this; } inline square& read () { scanf ("%d%d%d%d", &w1, &w2, &h1, &h2); return *this; } }; int main () { int t, n; square view, curr, largest; scanf ("%d", &t); while (t--){ scanf ("%d", &n); largest = view = curr.read (); while (--n){ view = view + curr.read (); if (largest <= curr) largest = curr; } printf ("%s\n", (view == largest? "TAK" : "NIE")); } } |