답안 #912706

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
912706 2024-01-19T18:18:53 Z NK_ Bliskost (COI23_bliskost) C++17
100 / 100
196 ms 20452 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'

using str = string;

template<class T> using V = vector<T>;
using vi = V<int>;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	int N, Q; cin >> N >> Q;
	str S; cin >> S;
	str T; cin >> T;


	int pos = 0, neg = 0;
	vi D(N); for(int i = 0; i < N; i++) {
		D[i] = S[i] - T[i];
		if (D[i] < 0) D[i] += 26;

		if (i % 2 == 0) pos += D[i];
		else neg += D[i];
	}

	cout << (pos % 26 == neg % 26 ? "da" : "ne") << nl;
	for(int q = 0; q < Q; q++) {
		int i; char x; cin >> i >> x; --i;
		S[i] = x;

		if (i % 2 == 0) pos -= D[i];
		else neg -= D[i];

		D[i] = S[i] - T[i];
		if (D[i] < 0) D[i] += 26;

		if (i % 2 == 0) pos += D[i];
		else neg += D[i];

		cout << (pos % 26 == neg % 26 ? "da" : "ne") << nl;
	}


	exit(0-0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 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 348 KB Output is correct
23 Correct 0 ms 456 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 600 KB Output is correct
26 Correct 0 ms 456 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 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 348 KB Output is correct
23 Correct 0 ms 456 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 600 KB Output is correct
26 Correct 0 ms 456 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 10 ms 8332 KB Output is correct
32 Correct 10 ms 8332 KB Output is correct
33 Correct 10 ms 8352 KB Output is correct
34 Correct 10 ms 8348 KB Output is correct
35 Correct 11 ms 8620 KB Output is correct
36 Correct 10 ms 8692 KB Output is correct
37 Correct 10 ms 8692 KB Output is correct
38 Correct 10 ms 8348 KB Output is correct
39 Correct 10 ms 8696 KB Output is correct
40 Correct 10 ms 8684 KB Output is correct
41 Correct 11 ms 8344 KB Output is correct
42 Correct 10 ms 8268 KB Output is correct
43 Correct 10 ms 8688 KB Output is correct
44 Correct 12 ms 8364 KB Output is correct
45 Correct 11 ms 8344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 12 ms 1116 KB Output is correct
17 Correct 11 ms 1116 KB Output is correct
18 Correct 11 ms 1116 KB Output is correct
19 Correct 11 ms 1116 KB Output is correct
20 Correct 11 ms 948 KB Output is correct
21 Correct 13 ms 1016 KB Output is correct
22 Correct 11 ms 1116 KB Output is correct
23 Correct 13 ms 1116 KB Output is correct
24 Correct 11 ms 1116 KB Output is correct
25 Correct 12 ms 1116 KB Output is correct
26 Correct 11 ms 1116 KB Output is correct
27 Correct 11 ms 1116 KB Output is correct
28 Correct 16 ms 1116 KB Output is correct
29 Correct 12 ms 1116 KB Output is correct
30 Correct 12 ms 1008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 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 348 KB Output is correct
23 Correct 0 ms 456 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 600 KB Output is correct
26 Correct 0 ms 456 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 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 11 ms 1116 KB Output is correct
33 Correct 11 ms 1116 KB Output is correct
34 Correct 11 ms 1116 KB Output is correct
35 Correct 11 ms 948 KB Output is correct
36 Correct 13 ms 1016 KB Output is correct
37 Correct 11 ms 1116 KB Output is correct
38 Correct 13 ms 1116 KB Output is correct
39 Correct 11 ms 1116 KB Output is correct
40 Correct 12 ms 1116 KB Output is correct
41 Correct 11 ms 1116 KB Output is correct
42 Correct 11 ms 1116 KB Output is correct
43 Correct 16 ms 1116 KB Output is correct
44 Correct 12 ms 1116 KB Output is correct
45 Correct 12 ms 1008 KB Output is correct
46 Correct 12 ms 1116 KB Output is correct
47 Correct 12 ms 1116 KB Output is correct
48 Correct 13 ms 1340 KB Output is correct
49 Correct 16 ms 1116 KB Output is correct
50 Correct 15 ms 1116 KB Output is correct
51 Correct 12 ms 1116 KB Output is correct
52 Correct 12 ms 1116 KB Output is correct
53 Correct 13 ms 1116 KB Output is correct
54 Correct 12 ms 1116 KB Output is correct
55 Correct 12 ms 1116 KB Output is correct
56 Correct 12 ms 1116 KB Output is correct
57 Correct 13 ms 1116 KB Output is correct
58 Correct 12 ms 1116 KB Output is correct
59 Correct 12 ms 1116 KB Output is correct
60 Correct 12 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 1 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 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 348 KB Output is correct
23 Correct 0 ms 456 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 600 KB Output is correct
26 Correct 0 ms 456 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 10 ms 8332 KB Output is correct
32 Correct 10 ms 8332 KB Output is correct
33 Correct 10 ms 8352 KB Output is correct
34 Correct 10 ms 8348 KB Output is correct
35 Correct 11 ms 8620 KB Output is correct
36 Correct 10 ms 8692 KB Output is correct
37 Correct 10 ms 8692 KB Output is correct
38 Correct 10 ms 8348 KB Output is correct
39 Correct 10 ms 8696 KB Output is correct
40 Correct 10 ms 8684 KB Output is correct
41 Correct 11 ms 8344 KB Output is correct
42 Correct 10 ms 8268 KB Output is correct
43 Correct 10 ms 8688 KB Output is correct
44 Correct 12 ms 8364 KB Output is correct
45 Correct 11 ms 8344 KB Output is correct
46 Correct 12 ms 1116 KB Output is correct
47 Correct 11 ms 1116 KB Output is correct
48 Correct 11 ms 1116 KB Output is correct
49 Correct 11 ms 1116 KB Output is correct
50 Correct 11 ms 948 KB Output is correct
51 Correct 13 ms 1016 KB Output is correct
52 Correct 11 ms 1116 KB Output is correct
53 Correct 13 ms 1116 KB Output is correct
54 Correct 11 ms 1116 KB Output is correct
55 Correct 12 ms 1116 KB Output is correct
56 Correct 11 ms 1116 KB Output is correct
57 Correct 11 ms 1116 KB Output is correct
58 Correct 16 ms 1116 KB Output is correct
59 Correct 12 ms 1116 KB Output is correct
60 Correct 12 ms 1008 KB Output is correct
61 Correct 12 ms 1116 KB Output is correct
62 Correct 12 ms 1116 KB Output is correct
63 Correct 13 ms 1340 KB Output is correct
64 Correct 16 ms 1116 KB Output is correct
65 Correct 15 ms 1116 KB Output is correct
66 Correct 12 ms 1116 KB Output is correct
67 Correct 12 ms 1116 KB Output is correct
68 Correct 13 ms 1116 KB Output is correct
69 Correct 12 ms 1116 KB Output is correct
70 Correct 12 ms 1116 KB Output is correct
71 Correct 12 ms 1116 KB Output is correct
72 Correct 13 ms 1116 KB Output is correct
73 Correct 12 ms 1116 KB Output is correct
74 Correct 12 ms 1116 KB Output is correct
75 Correct 12 ms 1116 KB Output is correct
76 Correct 155 ms 20096 KB Output is correct
77 Correct 152 ms 20384 KB Output is correct
78 Correct 154 ms 19956 KB Output is correct
79 Correct 153 ms 20076 KB Output is correct
80 Correct 148 ms 20096 KB Output is correct
81 Correct 151 ms 20088 KB Output is correct
82 Correct 196 ms 20196 KB Output is correct
83 Correct 165 ms 20108 KB Output is correct
84 Correct 162 ms 20100 KB Output is correct
85 Correct 165 ms 19884 KB Output is correct
86 Correct 157 ms 20444 KB Output is correct
87 Correct 155 ms 20452 KB Output is correct
88 Correct 156 ms 20264 KB Output is correct
89 Correct 174 ms 20128 KB Output is correct
90 Correct 153 ms 20416 KB Output is correct