답안 #998131

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
998131 2024-06-13T10:16:41 Z MilosMilutinovic Bliskost (COI23_bliskost) C++14
100 / 100
181 ms 16004 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, q;
char s[N], t[N];
int main() {
    scanf("%d%d", &n, &q);
    scanf("%s", s + 1);
    scanf("%s", t + 1);
    int d = 0;
    for (int i = 1; i < n; i++)
        d = (d + (t[i] - 'a') * (i % 2 == (n - 1) % 2 ? 1 : -1) + (s[i] - 'a') * (i % 2 == (n - 1) % 2 ? -1 : 1) + 52) % 26;
    if (((((int) (s[n] + d) % 26) + 52) % 26) == ((int) t[n] % 26)) printf("da\n");
    else printf("ne\n");
    while (q--) {
        int p;
        char c;
        scanf("%d %c", &p, &c);
        if (p < n) d = (d - ((t[p] - 'a') * (p % 2 == (n - 1) % 2 ? 1 : -1) + (s[p] - 'a') * (p % 2 == (n - 1) % 2 ? -1 : 1)) + 52) % 26;
        s[p] = c;
        if (p < n) d = (d + (t[p] - 'a') * (p % 2 == (n - 1) % 2 ? 1 : -1) + (s[p] - 'a') * (p % 2 == (n - 1) % 2 ? -1 : 1) + 52) % 26;
        if (((((int) (s[n] + d) % 26) + 52) % 26) == ((int) t[n] % 26)) printf("da\n");
        else printf("ne\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d%d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%s", s + 1);
      |     ~~~~~^~~~~~~~~~~~~
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%s", t + 1);
      |     ~~~~~^~~~~~~~~~~~~
Main.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%d %c", &p, &c);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 448 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 448 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 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 10 ms 4152 KB Output is correct
32 Correct 10 ms 4188 KB Output is correct
33 Correct 10 ms 4188 KB Output is correct
34 Correct 12 ms 4188 KB Output is correct
35 Correct 10 ms 4444 KB Output is correct
36 Correct 12 ms 4240 KB Output is correct
37 Correct 12 ms 4252 KB Output is correct
38 Correct 10 ms 4444 KB Output is correct
39 Correct 10 ms 4244 KB Output is correct
40 Correct 11 ms 4188 KB Output is correct
41 Correct 11 ms 4244 KB Output is correct
42 Correct 10 ms 4336 KB Output is correct
43 Correct 11 ms 4444 KB Output is correct
44 Correct 12 ms 4440 KB Output is correct
45 Correct 11 ms 4252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 13 ms 1116 KB Output is correct
17 Correct 11 ms 1120 KB Output is correct
18 Correct 10 ms 1116 KB Output is correct
19 Correct 10 ms 1116 KB Output is correct
20 Correct 10 ms 1116 KB Output is correct
21 Correct 11 ms 988 KB Output is correct
22 Correct 11 ms 996 KB Output is correct
23 Correct 10 ms 1116 KB Output is correct
24 Correct 10 ms 1000 KB Output is correct
25 Correct 20 ms 984 KB Output is correct
26 Correct 19 ms 1056 KB Output is correct
27 Correct 11 ms 1116 KB Output is correct
28 Correct 10 ms 1056 KB Output is correct
29 Correct 20 ms 1104 KB Output is correct
30 Correct 11 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 448 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 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 13 ms 1116 KB Output is correct
32 Correct 11 ms 1120 KB Output is correct
33 Correct 10 ms 1116 KB Output is correct
34 Correct 10 ms 1116 KB Output is correct
35 Correct 10 ms 1116 KB Output is correct
36 Correct 11 ms 988 KB Output is correct
37 Correct 11 ms 996 KB Output is correct
38 Correct 10 ms 1116 KB Output is correct
39 Correct 10 ms 1000 KB Output is correct
40 Correct 20 ms 984 KB Output is correct
41 Correct 19 ms 1056 KB Output is correct
42 Correct 11 ms 1116 KB Output is correct
43 Correct 10 ms 1056 KB Output is correct
44 Correct 20 ms 1104 KB Output is correct
45 Correct 11 ms 1116 KB Output is correct
46 Correct 11 ms 1116 KB Output is correct
47 Correct 11 ms 1116 KB Output is correct
48 Correct 11 ms 1112 KB Output is correct
49 Correct 11 ms 1228 KB Output is correct
50 Correct 11 ms 1296 KB Output is correct
51 Correct 11 ms 1324 KB Output is correct
52 Correct 11 ms 1224 KB Output is correct
53 Correct 11 ms 1124 KB Output is correct
54 Correct 12 ms 1320 KB Output is correct
55 Correct 11 ms 1116 KB Output is correct
56 Correct 12 ms 1100 KB Output is correct
57 Correct 11 ms 1116 KB Output is correct
58 Correct 16 ms 1116 KB Output is correct
59 Correct 11 ms 1108 KB Output is correct
60 Correct 13 ms 1288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 448 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 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 10 ms 4152 KB Output is correct
32 Correct 10 ms 4188 KB Output is correct
33 Correct 10 ms 4188 KB Output is correct
34 Correct 12 ms 4188 KB Output is correct
35 Correct 10 ms 4444 KB Output is correct
36 Correct 12 ms 4240 KB Output is correct
37 Correct 12 ms 4252 KB Output is correct
38 Correct 10 ms 4444 KB Output is correct
39 Correct 10 ms 4244 KB Output is correct
40 Correct 11 ms 4188 KB Output is correct
41 Correct 11 ms 4244 KB Output is correct
42 Correct 10 ms 4336 KB Output is correct
43 Correct 11 ms 4444 KB Output is correct
44 Correct 12 ms 4440 KB Output is correct
45 Correct 11 ms 4252 KB Output is correct
46 Correct 13 ms 1116 KB Output is correct
47 Correct 11 ms 1120 KB Output is correct
48 Correct 10 ms 1116 KB Output is correct
49 Correct 10 ms 1116 KB Output is correct
50 Correct 10 ms 1116 KB Output is correct
51 Correct 11 ms 988 KB Output is correct
52 Correct 11 ms 996 KB Output is correct
53 Correct 10 ms 1116 KB Output is correct
54 Correct 10 ms 1000 KB Output is correct
55 Correct 20 ms 984 KB Output is correct
56 Correct 19 ms 1056 KB Output is correct
57 Correct 11 ms 1116 KB Output is correct
58 Correct 10 ms 1056 KB Output is correct
59 Correct 20 ms 1104 KB Output is correct
60 Correct 11 ms 1116 KB Output is correct
61 Correct 11 ms 1116 KB Output is correct
62 Correct 11 ms 1116 KB Output is correct
63 Correct 11 ms 1112 KB Output is correct
64 Correct 11 ms 1228 KB Output is correct
65 Correct 11 ms 1296 KB Output is correct
66 Correct 11 ms 1324 KB Output is correct
67 Correct 11 ms 1224 KB Output is correct
68 Correct 11 ms 1124 KB Output is correct
69 Correct 12 ms 1320 KB Output is correct
70 Correct 11 ms 1116 KB Output is correct
71 Correct 12 ms 1100 KB Output is correct
72 Correct 11 ms 1116 KB Output is correct
73 Correct 16 ms 1116 KB Output is correct
74 Correct 11 ms 1108 KB Output is correct
75 Correct 13 ms 1288 KB Output is correct
76 Correct 155 ms 15952 KB Output is correct
77 Correct 164 ms 15808 KB Output is correct
78 Correct 147 ms 15956 KB Output is correct
79 Correct 181 ms 15956 KB Output is correct
80 Correct 161 ms 15792 KB Output is correct
81 Correct 152 ms 15816 KB Output is correct
82 Correct 171 ms 16004 KB Output is correct
83 Correct 157 ms 15956 KB Output is correct
84 Correct 153 ms 15984 KB Output is correct
85 Correct 147 ms 15904 KB Output is correct
86 Correct 179 ms 15912 KB Output is correct
87 Correct 145 ms 15808 KB Output is correct
88 Correct 181 ms 15968 KB Output is correct
89 Correct 144 ms 15956 KB Output is correct
90 Correct 144 ms 15952 KB Output is correct