# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243121 | 2020-06-30T11:26:35 Z | osaaateiasavtnl | Broken Device (JOI17_broken_device) | C++14 | 62 ms | 3312 KB |
#include<bits/stdc++.h> using namespace std; #define ii pair <int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcountll #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock()/CLOCKS_PER_SEC #define debug(x) std::cout << #x << ": " << x << '\n'; #include "Annalib.h" int sh1[200]; mt19937 rnd1(2007); void Anna( int N, long long X, int K, int P[] ){ for (int i = 0; i < 200; ++i) sh1[i] = rnd1()%3; /* for (int i = 0; i < 10; ++i) cout << up1[i]; cout << endl; */ vector <int> tri; while (X) { tri.app(X%3); X /= 3; } reverse(all(tri)); vector <bool> used(N); for (int i = 0; i < K; ++i) used[P[i]] = 1; /* cout << "tri : "; for (auto e : tri) cout << e << ' '; cout << endl; */ int tryed = 0; int i = 0, ptr = 0; int em = 0; while (i + 1 < N) { auto check = [&]() { if (ptr == tri.size()) return false; int x = tri[ptr]+1; x += sh1[i]; if (x > 3) x -= 3; bool ans = (!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1)); if ((!used[i] || !used[i+1]) && !ans) ++tryed; return (!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1)); }; if (!used[i] && !used[i+1]) ++em; if (check()) { int x = tri[ptr]+1; x += sh1[i]; if (x > 3) x -= 3; ++ptr; Set(i, x & 1); Set(i + 1, (x >> 1) & 1); } else { Set(i, 0); Set(i + 1, 0); } i += 2; } if (ptr < tri.size()) { /* cout << "tri : " << tri.size() << endl; debug(em); for (int i = 0; i < tri.size(); ++i) { int x = tri[i]+1; x += sh1[i]; if (x > 3) x -= 3; cout << x << ' '; } cout << endl; ptr = 0; i = 0; while (i + 1 < N) { auto check = [&]() { if (ptr == tri.size()) return false; int x = tri[ptr]+1; x += sh1[ptr]; if (x > 3) x -= 3; bool ans = (!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1)); if ((!used[i] || !used[i+1]) && !ans) { cout << "tryed " << i << ' ' << x << endl; } return (!used[i] || !(x&1)) && (!used[i+1] || !((x >> 1) & 1)); }; if (check()) { int x = tri[ptr]+1; x += sh1[ptr]; if (x > 3) x -= 3; ++ptr; } else { } i += 2; } exit(0); */ while (1) cout << "find" << endl; exit(0); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 3072 KB | Output is correct - L* = 40 |
2 | Correct | 53 ms | 2816 KB | Output is correct - L* = 40 |
3 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
4 | Correct | 55 ms | 3056 KB | Output is correct - L* = 40 |
5 | Correct | 55 ms | 3072 KB | Output is correct - L* = 40 |
6 | Correct | 53 ms | 3312 KB | Output is correct - L* = 40 |
7 | Correct | 52 ms | 3072 KB | Output is correct - L* = 40 |
8 | Correct | 54 ms | 3072 KB | Output is correct - L* = 40 |
9 | Correct | 54 ms | 2896 KB | Output is correct - L* = 40 |
10 | Correct | 54 ms | 3072 KB | Output is correct - L* = 40 |
11 | Correct | 52 ms | 3056 KB | Output is correct - L* = 40 |
12 | Correct | 52 ms | 3072 KB | Output is correct - L* = 40 |
13 | Correct | 54 ms | 3104 KB | Output is correct - L* = 40 |
14 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
15 | Correct | 52 ms | 3072 KB | Output is correct - L* = 40 |
16 | Correct | 53 ms | 3056 KB | Output is correct - L* = 40 |
17 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
18 | Correct | 54 ms | 3056 KB | Output is correct - L* = 40 |
19 | Correct | 53 ms | 3056 KB | Output is correct - L* = 40 |
20 | Correct | 55 ms | 3056 KB | Output is correct - L* = 40 |
21 | Correct | 54 ms | 3072 KB | Output is correct - L* = 40 |
22 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
23 | Correct | 54 ms | 3072 KB | Output is correct - L* = 40 |
24 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
25 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
26 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
27 | Correct | 62 ms | 3056 KB | Output is correct - L* = 40 |
28 | Correct | 53 ms | 3040 KB | Output is correct - L* = 40 |
29 | Correct | 52 ms | 3072 KB | Output is correct - L* = 40 |
30 | Correct | 53 ms | 3056 KB | Output is correct - L* = 40 |
31 | Correct | 55 ms | 3072 KB | Output is correct - L* = 40 |
32 | Correct | 53 ms | 3056 KB | Output is correct - L* = 40 |
33 | Correct | 53 ms | 3288 KB | Output is correct - L* = 40 |
34 | Correct | 54 ms | 3072 KB | Output is correct - L* = 40 |
35 | Correct | 53 ms | 3056 KB | Output is correct - L* = 40 |
36 | Correct | 51 ms | 3056 KB | Output is correct - L* = 40 |
37 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |
38 | Correct | 53 ms | 3056 KB | Output is correct - L* = 40 |
39 | Correct | 52 ms | 3072 KB | Output is correct - L* = 40 |
40 | Correct | 53 ms | 3072 KB | Output is correct - L* = 40 |