Submission #791440

# Submission time Handle Problem Language Result Execution time Memory
791440 2023-07-24T06:31:07 Z 박영우(#10050) Bliskost (COI23_bliskost) C++17
100 / 100
180 ms 14388 KB
#include <bits/stdc++.h>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 1010101
#define MAXS 500
#define INF 1000000000000000001
#define bb ' '
#define ln '\n'
#define Ln '\n'
int A[2][MAX];
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int N, Q;
	cin >> N >> Q;
	int i;
	string s[2];
	cin >> s[0] >> s[1];
	for (i = 0; i < N; i++) A[0][i] = s[0][i] - 'a';
	for (i = 0; i < N; i++) A[1][i] = s[1][i] - 'a';
	int sum[2] = { 0, 0 };
	for (auto t : { 0, 1 }) {
		for (i = 0; i < N; i++) {
			if (i & 1) sum[t] -= A[t][i];
			else sum[t] += A[t][i];
		}
	}
	if ((sum[0] - sum[1]) % 26) cout << "ne" << ln;
	else cout << "da" << ln;
	while (Q--) {
		char a;
		cin >> i >> a;
		i--;
		if (i & 1) sum[0] += A[0][i];
		else sum[0] -= A[0][i];
		A[0][i] = a - 'a';
		if (i & 1) sum[0] -= A[0][i];
		else sum[0] += A[0][i];
		if ((sum[0] - sum[1]) % 26) cout << "ne" << ln;
		else cout << "da" << ln;		
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 352 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 352 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 352 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 11 ms 10700 KB Output is correct
32 Correct 12 ms 10820 KB Output is correct
33 Correct 13 ms 10808 KB Output is correct
34 Correct 11 ms 10220 KB Output is correct
35 Correct 12 ms 10760 KB Output is correct
36 Correct 12 ms 10596 KB Output is correct
37 Correct 12 ms 11168 KB Output is correct
38 Correct 14 ms 10776 KB Output is correct
39 Correct 14 ms 11244 KB Output is correct
40 Correct 15 ms 11204 KB Output is correct
41 Correct 12 ms 10772 KB Output is correct
42 Correct 13 ms 10848 KB Output is correct
43 Correct 12 ms 11252 KB Output is correct
44 Correct 13 ms 10860 KB Output is correct
45 Correct 12 ms 10772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 352 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 11 ms 980 KB Output is correct
17 Correct 11 ms 940 KB Output is correct
18 Correct 11 ms 996 KB Output is correct
19 Correct 12 ms 928 KB Output is correct
20 Correct 12 ms 908 KB Output is correct
21 Correct 11 ms 980 KB Output is correct
22 Correct 12 ms 1008 KB Output is correct
23 Correct 12 ms 976 KB Output is correct
24 Correct 14 ms 996 KB Output is correct
25 Correct 11 ms 980 KB Output is correct
26 Correct 11 ms 980 KB Output is correct
27 Correct 11 ms 960 KB Output is correct
28 Correct 11 ms 932 KB Output is correct
29 Correct 14 ms 932 KB Output is correct
30 Correct 12 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 352 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 11 ms 980 KB Output is correct
32 Correct 11 ms 940 KB Output is correct
33 Correct 11 ms 996 KB Output is correct
34 Correct 12 ms 928 KB Output is correct
35 Correct 12 ms 908 KB Output is correct
36 Correct 11 ms 980 KB Output is correct
37 Correct 12 ms 1008 KB Output is correct
38 Correct 12 ms 976 KB Output is correct
39 Correct 14 ms 996 KB Output is correct
40 Correct 11 ms 980 KB Output is correct
41 Correct 11 ms 980 KB Output is correct
42 Correct 11 ms 960 KB Output is correct
43 Correct 11 ms 932 KB Output is correct
44 Correct 14 ms 932 KB Output is correct
45 Correct 12 ms 980 KB Output is correct
46 Correct 13 ms 1164 KB Output is correct
47 Correct 13 ms 1208 KB Output is correct
48 Correct 12 ms 1100 KB Output is correct
49 Correct 12 ms 1180 KB Output is correct
50 Correct 12 ms 1108 KB Output is correct
51 Correct 12 ms 1184 KB Output is correct
52 Correct 15 ms 1148 KB Output is correct
53 Correct 12 ms 1108 KB Output is correct
54 Correct 12 ms 1200 KB Output is correct
55 Correct 12 ms 1108 KB Output is correct
56 Correct 12 ms 1220 KB Output is correct
57 Correct 13 ms 1128 KB Output is correct
58 Correct 12 ms 1108 KB Output is correct
59 Correct 12 ms 1108 KB Output is correct
60 Correct 12 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 1 ms 352 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 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 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 11 ms 10700 KB Output is correct
32 Correct 12 ms 10820 KB Output is correct
33 Correct 13 ms 10808 KB Output is correct
34 Correct 11 ms 10220 KB Output is correct
35 Correct 12 ms 10760 KB Output is correct
36 Correct 12 ms 10596 KB Output is correct
37 Correct 12 ms 11168 KB Output is correct
38 Correct 14 ms 10776 KB Output is correct
39 Correct 14 ms 11244 KB Output is correct
40 Correct 15 ms 11204 KB Output is correct
41 Correct 12 ms 10772 KB Output is correct
42 Correct 13 ms 10848 KB Output is correct
43 Correct 12 ms 11252 KB Output is correct
44 Correct 13 ms 10860 KB Output is correct
45 Correct 12 ms 10772 KB Output is correct
46 Correct 11 ms 980 KB Output is correct
47 Correct 11 ms 940 KB Output is correct
48 Correct 11 ms 996 KB Output is correct
49 Correct 12 ms 928 KB Output is correct
50 Correct 12 ms 908 KB Output is correct
51 Correct 11 ms 980 KB Output is correct
52 Correct 12 ms 1008 KB Output is correct
53 Correct 12 ms 976 KB Output is correct
54 Correct 14 ms 996 KB Output is correct
55 Correct 11 ms 980 KB Output is correct
56 Correct 11 ms 980 KB Output is correct
57 Correct 11 ms 960 KB Output is correct
58 Correct 11 ms 932 KB Output is correct
59 Correct 14 ms 932 KB Output is correct
60 Correct 12 ms 980 KB Output is correct
61 Correct 13 ms 1164 KB Output is correct
62 Correct 13 ms 1208 KB Output is correct
63 Correct 12 ms 1100 KB Output is correct
64 Correct 12 ms 1180 KB Output is correct
65 Correct 12 ms 1108 KB Output is correct
66 Correct 12 ms 1184 KB Output is correct
67 Correct 15 ms 1148 KB Output is correct
68 Correct 12 ms 1108 KB Output is correct
69 Correct 12 ms 1200 KB Output is correct
70 Correct 12 ms 1108 KB Output is correct
71 Correct 12 ms 1220 KB Output is correct
72 Correct 13 ms 1128 KB Output is correct
73 Correct 12 ms 1108 KB Output is correct
74 Correct 12 ms 1108 KB Output is correct
75 Correct 12 ms 1108 KB Output is correct
76 Correct 148 ms 14388 KB Output is correct
77 Correct 180 ms 14152 KB Output is correct
78 Correct 159 ms 13696 KB Output is correct
79 Correct 154 ms 13736 KB Output is correct
80 Correct 147 ms 13696 KB Output is correct
81 Correct 152 ms 13644 KB Output is correct
82 Correct 147 ms 13672 KB Output is correct
83 Correct 176 ms 13720 KB Output is correct
84 Correct 164 ms 13640 KB Output is correct
85 Correct 153 ms 13712 KB Output is correct
86 Correct 172 ms 14072 KB Output is correct
87 Correct 144 ms 14044 KB Output is correct
88 Correct 145 ms 14148 KB Output is correct
89 Correct 139 ms 13684 KB Output is correct
90 Correct 145 ms 14064 KB Output is correct