# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791415 | 2023-07-24T06:12:43 Z | 박상훈(#10047) | Bliskost (COI23_bliskost) | C++17 | 198 ms | 9172 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; char a[1001000], b[1001000]; int ansa, ansb, val[1010], sgn[1001000], n; inline void add(int &x, int y){ y %= 26; if (y<0) y += 26; x = (x+y) % 26; } void calc(char a[], int &ans){ for (int i=1;i<=n;i++) add(ans, val[a[i]] * sgn[i]); } int main(){ int q; scanf("%d %d", &n, &q); sgn[n] = -1; for (int i=n-1,z=0;i>0;i--,z^=1){ if (z) sgn[i] = -1; else sgn[i] = 1; } val['a'] = 0; for (int i=1;i<26;i++) val['a'+i] = 26-i; scanf("%s", a+1); scanf("%s", b+1); calc(a, ansa); calc(b, ansb); if (ansa==ansb) printf("da\n"); else printf("ne\n"); // printf(" %d / %d\n", ansa, ansb); while(q--){ int x; char p; scanf("%d %c", &x, &p); add(ansa, - val[a[x]] * sgn[x]); a[x] = p; add(ansa, val[a[x]] * sgn[x]); if (ansa==ansb) printf("da\n"); else printf("ne\n"); // printf(" %d / %d\n", ansa, ansb); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 224 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 224 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 14 ms | 6100 KB | Output is correct |
32 | Correct | 14 ms | 6100 KB | Output is correct |
33 | Correct | 15 ms | 6100 KB | Output is correct |
34 | Correct | 17 ms | 6228 KB | Output is correct |
35 | Correct | 14 ms | 6092 KB | Output is correct |
36 | Correct | 14 ms | 6100 KB | Output is correct |
37 | Correct | 15 ms | 6176 KB | Output is correct |
38 | Correct | 14 ms | 6128 KB | Output is correct |
39 | Correct | 14 ms | 6172 KB | Output is correct |
40 | Correct | 17 ms | 6156 KB | Output is correct |
41 | Correct | 14 ms | 6100 KB | Output is correct |
42 | Correct | 14 ms | 6156 KB | Output is correct |
43 | Correct | 14 ms | 6100 KB | Output is correct |
44 | Correct | 15 ms | 6172 KB | Output is correct |
45 | Correct | 14 ms | 6164 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 12 ms | 596 KB | Output is correct |
17 | Correct | 13 ms | 596 KB | Output is correct |
18 | Correct | 13 ms | 592 KB | Output is correct |
19 | Correct | 13 ms | 548 KB | Output is correct |
20 | Correct | 15 ms | 664 KB | Output is correct |
21 | Correct | 13 ms | 536 KB | Output is correct |
22 | Correct | 12 ms | 596 KB | Output is correct |
23 | Correct | 13 ms | 596 KB | Output is correct |
24 | Correct | 13 ms | 532 KB | Output is correct |
25 | Correct | 16 ms | 584 KB | Output is correct |
26 | Correct | 15 ms | 596 KB | Output is correct |
27 | Correct | 14 ms | 596 KB | Output is correct |
28 | Correct | 14 ms | 596 KB | Output is correct |
29 | Correct | 13 ms | 520 KB | Output is correct |
30 | Correct | 12 ms | 580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 224 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 12 ms | 596 KB | Output is correct |
32 | Correct | 13 ms | 596 KB | Output is correct |
33 | Correct | 13 ms | 592 KB | Output is correct |
34 | Correct | 13 ms | 548 KB | Output is correct |
35 | Correct | 15 ms | 664 KB | Output is correct |
36 | Correct | 13 ms | 536 KB | Output is correct |
37 | Correct | 12 ms | 596 KB | Output is correct |
38 | Correct | 13 ms | 596 KB | Output is correct |
39 | Correct | 13 ms | 532 KB | Output is correct |
40 | Correct | 16 ms | 584 KB | Output is correct |
41 | Correct | 15 ms | 596 KB | Output is correct |
42 | Correct | 14 ms | 596 KB | Output is correct |
43 | Correct | 14 ms | 596 KB | Output is correct |
44 | Correct | 13 ms | 520 KB | Output is correct |
45 | Correct | 12 ms | 580 KB | Output is correct |
46 | Correct | 13 ms | 572 KB | Output is correct |
47 | Correct | 13 ms | 572 KB | Output is correct |
48 | Correct | 13 ms | 556 KB | Output is correct |
49 | Correct | 13 ms | 596 KB | Output is correct |
50 | Correct | 13 ms | 596 KB | Output is correct |
51 | Correct | 14 ms | 628 KB | Output is correct |
52 | Correct | 13 ms | 552 KB | Output is correct |
53 | Correct | 13 ms | 636 KB | Output is correct |
54 | Correct | 13 ms | 568 KB | Output is correct |
55 | Correct | 17 ms | 584 KB | Output is correct |
56 | Correct | 13 ms | 596 KB | Output is correct |
57 | Correct | 13 ms | 556 KB | Output is correct |
58 | Correct | 13 ms | 596 KB | Output is correct |
59 | Correct | 13 ms | 596 KB | Output is correct |
60 | Correct | 13 ms | 596 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Correct | 0 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 224 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 14 ms | 6100 KB | Output is correct |
32 | Correct | 14 ms | 6100 KB | Output is correct |
33 | Correct | 15 ms | 6100 KB | Output is correct |
34 | Correct | 17 ms | 6228 KB | Output is correct |
35 | Correct | 14 ms | 6092 KB | Output is correct |
36 | Correct | 14 ms | 6100 KB | Output is correct |
37 | Correct | 15 ms | 6176 KB | Output is correct |
38 | Correct | 14 ms | 6128 KB | Output is correct |
39 | Correct | 14 ms | 6172 KB | Output is correct |
40 | Correct | 17 ms | 6156 KB | Output is correct |
41 | Correct | 14 ms | 6100 KB | Output is correct |
42 | Correct | 14 ms | 6156 KB | Output is correct |
43 | Correct | 14 ms | 6100 KB | Output is correct |
44 | Correct | 15 ms | 6172 KB | Output is correct |
45 | Correct | 14 ms | 6164 KB | Output is correct |
46 | Correct | 12 ms | 596 KB | Output is correct |
47 | Correct | 13 ms | 596 KB | Output is correct |
48 | Correct | 13 ms | 592 KB | Output is correct |
49 | Correct | 13 ms | 548 KB | Output is correct |
50 | Correct | 15 ms | 664 KB | Output is correct |
51 | Correct | 13 ms | 536 KB | Output is correct |
52 | Correct | 12 ms | 596 KB | Output is correct |
53 | Correct | 13 ms | 596 KB | Output is correct |
54 | Correct | 13 ms | 532 KB | Output is correct |
55 | Correct | 16 ms | 584 KB | Output is correct |
56 | Correct | 15 ms | 596 KB | Output is correct |
57 | Correct | 14 ms | 596 KB | Output is correct |
58 | Correct | 14 ms | 596 KB | Output is correct |
59 | Correct | 13 ms | 520 KB | Output is correct |
60 | Correct | 12 ms | 580 KB | Output is correct |
61 | Correct | 13 ms | 572 KB | Output is correct |
62 | Correct | 13 ms | 572 KB | Output is correct |
63 | Correct | 13 ms | 556 KB | Output is correct |
64 | Correct | 13 ms | 596 KB | Output is correct |
65 | Correct | 13 ms | 596 KB | Output is correct |
66 | Correct | 14 ms | 628 KB | Output is correct |
67 | Correct | 13 ms | 552 KB | Output is correct |
68 | Correct | 13 ms | 636 KB | Output is correct |
69 | Correct | 13 ms | 568 KB | Output is correct |
70 | Correct | 17 ms | 584 KB | Output is correct |
71 | Correct | 13 ms | 596 KB | Output is correct |
72 | Correct | 13 ms | 556 KB | Output is correct |
73 | Correct | 13 ms | 596 KB | Output is correct |
74 | Correct | 13 ms | 596 KB | Output is correct |
75 | Correct | 13 ms | 596 KB | Output is correct |
76 | Correct | 185 ms | 9172 KB | Output is correct |
77 | Correct | 160 ms | 9164 KB | Output is correct |
78 | Correct | 162 ms | 9164 KB | Output is correct |
79 | Correct | 198 ms | 9068 KB | Output is correct |
80 | Correct | 165 ms | 9164 KB | Output is correct |
81 | Correct | 176 ms | 9160 KB | Output is correct |
82 | Correct | 176 ms | 9088 KB | Output is correct |
83 | Correct | 163 ms | 9136 KB | Output is correct |
84 | Correct | 161 ms | 9148 KB | Output is correct |
85 | Correct | 160 ms | 9068 KB | Output is correct |
86 | Correct | 183 ms | 9144 KB | Output is correct |
87 | Correct | 162 ms | 9116 KB | Output is correct |
88 | Correct | 190 ms | 9164 KB | Output is correct |
89 | Correct | 158 ms | 9112 KB | Output is correct |
90 | Correct | 163 ms | 9168 KB | Output is correct |