# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
888484 | 2023-12-17T14:18:21 Z | fanwen | Bliskost (COI23_bliskost) | C++17 | 734 ms | 1880 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define ll long long #define file(name) \ if(fopen(name".inp", "r")) \ freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout); const int MAX = 1e5 + 5; int n, a[MAX], b[MAX], q, c[MAX]; bool check() { if(1LL * n * q > 1e8) return false; for (int i = 1; i <= n; ++i) { c[i] = a[i]; } for (int i = 1; i < n; ++i) { int d = (b[i] - c[i] + 26) % 26; c[i] = b[i]; c[i + 1] += d; c[i + 1] %= 26; } return c[n] == b[n]; } void you_make_it(void) { cin >> n >> q; for (int i = 1; i <= n; ++i) { char x; cin >> x; a[i] = x - 'a'; } for (int i = 1; i <= n; ++i) { char x; cin >> x; b[i] = x - 'a'; } cout << (check() ? "da" : "ne") << '\n'; while(q--) { int p; char x; cin >> p >> x; a[p] = x - 'a'; cout << (check() ? "da" : "ne") << '\n'; } } signed main() { #ifdef LOCAL freopen("TASK.inp", "r", stdin); freopen("TASK.out", "w", stdout); #endif file("bliskost"); auto start_time = chrono::steady_clock::now(); cin.tie(0), cout.tie(0) -> sync_with_stdio(0); you_make_it(); auto end_time = chrono::steady_clock::now(); cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl; return (0 ^ 0); } // Dream it. Wish it. Do it.
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 456 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 460 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 456 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 460 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 2 ms | 860 KB | Output is correct |
32 | Correct | 1 ms | 1024 KB | Output is correct |
33 | Correct | 1 ms | 988 KB | Output is correct |
34 | Correct | 1 ms | 860 KB | Output is correct |
35 | Correct | 1 ms | 860 KB | Output is correct |
36 | Correct | 1 ms | 860 KB | Output is correct |
37 | Incorrect | 1 ms | 860 KB | Output isn't correct |
38 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
16 | Correct | 12 ms | 1116 KB | Output is correct |
17 | Correct | 12 ms | 1112 KB | Output is correct |
18 | Correct | 12 ms | 1116 KB | Output is correct |
19 | Correct | 12 ms | 1128 KB | Output is correct |
20 | Correct | 12 ms | 1116 KB | Output is correct |
21 | Correct | 12 ms | 1116 KB | Output is correct |
22 | Correct | 12 ms | 1112 KB | Output is correct |
23 | Correct | 12 ms | 1112 KB | Output is correct |
24 | Correct | 12 ms | 1112 KB | Output is correct |
25 | Correct | 12 ms | 1116 KB | Output is correct |
26 | Correct | 12 ms | 1116 KB | Output is correct |
27 | Correct | 12 ms | 1116 KB | Output is correct |
28 | Correct | 12 ms | 1116 KB | Output is correct |
29 | Correct | 12 ms | 984 KB | Output is correct |
30 | Correct | 12 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 456 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 460 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 12 ms | 1116 KB | Output is correct |
32 | Correct | 12 ms | 1112 KB | Output is correct |
33 | Correct | 12 ms | 1116 KB | Output is correct |
34 | Correct | 12 ms | 1128 KB | Output is correct |
35 | Correct | 12 ms | 1116 KB | Output is correct |
36 | Correct | 12 ms | 1116 KB | Output is correct |
37 | Correct | 12 ms | 1112 KB | Output is correct |
38 | Correct | 12 ms | 1112 KB | Output is correct |
39 | Correct | 12 ms | 1112 KB | Output is correct |
40 | Correct | 12 ms | 1116 KB | Output is correct |
41 | Correct | 12 ms | 1116 KB | Output is correct |
42 | Correct | 12 ms | 1116 KB | Output is correct |
43 | Correct | 12 ms | 1116 KB | Output is correct |
44 | Correct | 12 ms | 984 KB | Output is correct |
45 | Correct | 12 ms | 1116 KB | Output is correct |
46 | Correct | 728 ms | 1420 KB | Output is correct |
47 | Correct | 722 ms | 1796 KB | Output is correct |
48 | Correct | 707 ms | 1880 KB | Output is correct |
49 | Correct | 708 ms | 1328 KB | Output is correct |
50 | Correct | 722 ms | 1340 KB | Output is correct |
51 | Correct | 713 ms | 1104 KB | Output is correct |
52 | Correct | 734 ms | 1328 KB | Output is correct |
53 | Correct | 704 ms | 1156 KB | Output is correct |
54 | Correct | 718 ms | 1500 KB | Output is correct |
55 | Correct | 704 ms | 1564 KB | Output is correct |
56 | Correct | 702 ms | 1316 KB | Output is correct |
57 | Correct | 713 ms | 1324 KB | Output is correct |
58 | Correct | 715 ms | 1312 KB | Output is correct |
59 | Correct | 726 ms | 1304 KB | Output is correct |
60 | Correct | 713 ms | 1292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 600 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 1 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 456 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 460 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 1 ms | 348 KB | Output is correct |
25 | Correct | 1 ms | 348 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Correct | 0 ms | 348 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 2 ms | 860 KB | Output is correct |
32 | Correct | 1 ms | 1024 KB | Output is correct |
33 | Correct | 1 ms | 988 KB | Output is correct |
34 | Correct | 1 ms | 860 KB | Output is correct |
35 | Correct | 1 ms | 860 KB | Output is correct |
36 | Correct | 1 ms | 860 KB | Output is correct |
37 | Incorrect | 1 ms | 860 KB | Output isn't correct |
38 | Halted | 0 ms | 0 KB | - |