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.
//test sprawdzaj�cy szybko�� find-union z biblioteczki earla //Krzysztof Kleiner #include<cstdio> #include<algorithm> #define FOR(i, b, n) for ( int (i) = b; (i) < (n); (i)++) #define FORR(i, b, n) for ( (i) = b; (i) < (n); (i)++) #define REP(i, n) for ( int (i) = 0; (i) < (n); (i)++) #define SC(n) scanf("%d", &(n)) #define SC2(n, m) scanf("%d%d", &(n), &(m)) #define SCLL(n) scanf("%lld", &(n)) #define PRT(n) printf("%d ", (n)) #define PRTLL(n) printf("%lld ", (n)) #define NXL printf("\n") typedef long long LL; typedef unsigned long long ULL; using namespace std; const int INF = 2000000000; int main() { int z; SC(z); while(z--) { int wmax = 0, wmin = INF, hmax = 0, hmin = INF; bool ok = 0; int n; SC(n); int w1, w2, h1, h2; REP(i, n) { SC2(w1, w2); SC2(h1, h2); if(ok) { if(w1 >= wmin && w2 <= wmax && h1 >= hmin && h2 <= hmax) continue; } else { if(w1 > wmin && w2 < wmax && h1 > hmin && h2 < hmax) continue; } wmin = min(wmin, w1); wmax = max(wmax, w2); hmin = min(hmin, h1); hmax = max(hmax, h2); if(w1 == wmin && w2 == wmax && h1 == hmin && h2 == hmax) ok = 1; else ok = 0; } if(ok) printf("TAK\n"); else printf("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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | //test sprawdzaj�cy szybko�� find-union z biblioteczki earla //Krzysztof Kleiner #include<cstdio> #include<algorithm> #define FOR(i, b, n) for ( int (i) = b; (i) < (n); (i)++) #define FORR(i, b, n) for ( (i) = b; (i) < (n); (i)++) #define REP(i, n) for ( int (i) = 0; (i) < (n); (i)++) #define SC(n) scanf("%d", &(n)) #define SC2(n, m) scanf("%d%d", &(n), &(m)) #define SCLL(n) scanf("%lld", &(n)) #define PRT(n) printf("%d ", (n)) #define PRTLL(n) printf("%lld ", (n)) #define NXL printf("\n") typedef long long LL; typedef unsigned long long ULL; using namespace std; const int INF = 2000000000; int main() { int z; SC(z); while(z--) { int wmax = 0, wmin = INF, hmax = 0, hmin = INF; bool ok = 0; int n; SC(n); int w1, w2, h1, h2; REP(i, n) { SC2(w1, w2); SC2(h1, h2); if(ok) { if(w1 >= wmin && w2 <= wmax && h1 >= hmin && h2 <= hmax) continue; } else { if(w1 > wmin && w2 < wmax && h1 > hmin && h2 < hmax) continue; } wmin = min(wmin, w1); wmax = max(wmax, w2); hmin = min(hmin, h1); hmax = max(hmax, h2); if(w1 == wmin && w2 == wmax && h1 == hmin && h2 == hmax) ok = 1; else ok = 0; } if(ok) printf("TAK\n"); else printf("NIE\n"); } return 0; } |