# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
527972 | 2022-02-18T21:42:46 Z | tabr | Martian DNA (IOI16_dna) | C++17 | 13 ms | 388 KB |
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif #ifdef tabr function<bool(string)> make_test; #else #include "dna.h" #endif mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count()); int rand_int(int a, int b) { // [a, b] return uniform_int_distribution<int>(a, b)(rng); } string analyse(int n, int) { string ans; int lst = -1; for (int i = 0; i < n; i++) { int x = rand_int(0, 1); string c = to_string(x); if (make_test(ans + c)) { lst = i; } else { x ^= 1; } ans += to_string(x); if (lst + 15 < i || i == n - 1) { if (make_test(ans)) { lst = i; continue; } debug(ans); int low = lst + 1; int high = (int) ans.size(); while (high - low > 1) { int mid = (high + low) >> 1; if (make_test(ans.substr(mid))) { low = mid; } else { high = mid; } } ans.resize(low); debug(ans); lst = low - 1; break; } } for (int i = (int) ans.size(); i < n; i++) { int x = rand_int(0, 1); string c = to_string(x); if (!make_test(c + ans)) { x ^= 1; } ans = to_string(x) + ans; } return ans; } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; make_test = [&](string p) { if (p.size() > s.size()) { return false; } for (int i = 0; i <= (int) (s.size() - p.size()); i++) { if (p == s.substr(i, p.size())) { return true; } } return false; }; cout << analyse((int) s.size(), 0) << '\n'; return 0; } #endif
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 292 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 0 ms | 204 KB | Output is correct |
20 | Incorrect | 1 ms | 204 KB | Wrong DNA |
21 | Incorrect | 0 ms | 204 KB | Wrong DNA |
22 | Incorrect | 1 ms | 204 KB | Wrong DNA |
23 | Incorrect | 0 ms | 204 KB | Wrong DNA |
24 | Incorrect | 1 ms | 204 KB | Wrong DNA |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Incorrect | 0 ms | 204 KB | Wrong DNA |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 216 KB | Output is correct |
17 | Incorrect | 0 ms | 204 KB | Wrong DNA |
18 | Incorrect | 1 ms | 204 KB | Wrong DNA |
19 | Incorrect | 0 ms | 204 KB | Wrong DNA |
20 | Incorrect | 1 ms | 204 KB | Wrong DNA |
21 | Incorrect | 1 ms | 204 KB | Wrong DNA |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 0 ms | 204 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 1 ms | 204 KB | Output is correct |
26 | Correct | 1 ms | 204 KB | Output is correct |
27 | Correct | 1 ms | 204 KB | Output is correct |
28 | Incorrect | 1 ms | 204 KB | Wrong DNA |
29 | Correct | 0 ms | 204 KB | Output is correct |
30 | Incorrect | 1 ms | 204 KB | Wrong DNA |
31 | Correct | 0 ms | 204 KB | Output is correct |
32 | Incorrect | 1 ms | 204 KB | Wrong DNA |
33 | Correct | 1 ms | 204 KB | Output is correct |
34 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Incorrect | 0 ms | 204 KB | Wrong DNA |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 204 KB | Output is correct |
14 | Incorrect | 1 ms | 332 KB | Wrong DNA |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Incorrect | 0 ms | 204 KB | Wrong DNA |
18 | Incorrect | 1 ms | 204 KB | Wrong DNA |
19 | Incorrect | 1 ms | 204 KB | Wrong DNA |
20 | Incorrect | 0 ms | 204 KB | Wrong DNA |
21 | Incorrect | 0 ms | 204 KB | Wrong DNA |
22 | Incorrect | 13 ms | 332 KB | Wrong DNA |
23 | Incorrect | 6 ms | 332 KB | Wrong DNA |
24 | Incorrect | 8 ms | 376 KB | Wrong DNA |
25 | Incorrect | 7 ms | 332 KB | Wrong DNA |
26 | Incorrect | 8 ms | 332 KB | Wrong DNA |
27 | Correct | 5 ms | 372 KB | Output is correct |
28 | Correct | 6 ms | 388 KB | Output is correct |
29 | Correct | 6 ms | 332 KB | Output is correct |
30 | Correct | 6 ms | 344 KB | Output is correct |
31 | Correct | 7 ms | 376 KB | Output is correct |
32 | Correct | 6 ms | 340 KB | Output is correct |
33 | Incorrect | 8 ms | 336 KB | Wrong DNA |
34 | Correct | 7 ms | 356 KB | Output is correct |
35 | Correct | 7 ms | 344 KB | Output is correct |
36 | Incorrect | 7 ms | 340 KB | Wrong DNA |
37 | Correct | 8 ms | 332 KB | Output is correct |
38 | Incorrect | 8 ms | 364 KB | Wrong DNA |
39 | Incorrect | 8 ms | 380 KB | Wrong DNA |