Submission #1114261

# Submission time Handle Problem Language Result Execution time Memory
1114261 2024-11-18T13:14:37 Z epicci23 Bliskost (COI23_bliskost) C++17
100 / 100
134 ms 16620 KB
#include "bits/stdc++.h"
#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;

void _(){
  int n,q;
  cin >> n >> q;
  string s,t;
  cin >> s >> t;
  array<int,2> pre = {0,0};
  for(int i = 0 ; i < n; i++){
    pre[i&1] += (t[i] - s[i] + 26) % 26;
  }	
  
  if((n-1)&1){
    if((pre[1]-pre[0])%26==0) cout << "da\n";
    else cout << "ne\n";
  }
  else{
  	if((pre[0]-pre[1])%26==0) cout << "da\n";
    else cout << "ne\n";
  }

  while(q--){
  	int ind;
  	char a;
  	cin >> ind >> a;
  	ind--;
    pre[ind&1]-=(t[ind]-s[ind]+26)%26;
    s[ind] = a;
    pre[ind&1]+=(t[ind]-s[ind]+26)%26;
    if((n-1)&1){
     if((pre[1]-pre[0])%26==0) cout << "da\n";
     else cout << "ne\n";
    }
    else{
  	 if((pre[0]-pre[1])%26==0) cout << "da\n";
     else cout << "ne\n";
    }
  }
}

int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tc=1;//cin >> tc;
  while(tc--) _();
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 504 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 504 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 8 ms 4332 KB Output is correct
32 Correct 8 ms 4600 KB Output is correct
33 Correct 8 ms 4504 KB Output is correct
34 Correct 8 ms 4496 KB Output is correct
35 Correct 9 ms 4588 KB Output is correct
36 Correct 8 ms 4840 KB Output is correct
37 Correct 9 ms 4840 KB Output is correct
38 Correct 9 ms 4508 KB Output is correct
39 Correct 8 ms 4844 KB Output is correct
40 Correct 8 ms 4832 KB Output is correct
41 Correct 9 ms 4588 KB Output is correct
42 Correct 10 ms 4588 KB Output is correct
43 Correct 9 ms 4844 KB Output is correct
44 Correct 9 ms 4512 KB Output is correct
45 Correct 9 ms 4492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 9 ms 1104 KB Output is correct
17 Correct 9 ms 1120 KB Output is correct
18 Correct 9 ms 984 KB Output is correct
19 Correct 9 ms 1104 KB Output is correct
20 Correct 8 ms 1104 KB Output is correct
21 Correct 8 ms 1104 KB Output is correct
22 Correct 8 ms 1024 KB Output is correct
23 Correct 8 ms 1104 KB Output is correct
24 Correct 14 ms 1104 KB Output is correct
25 Correct 8 ms 1104 KB Output is correct
26 Correct 9 ms 1104 KB Output is correct
27 Correct 8 ms 1104 KB Output is correct
28 Correct 8 ms 1104 KB Output is correct
29 Correct 8 ms 1104 KB Output is correct
30 Correct 10 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 504 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 9 ms 1104 KB Output is correct
32 Correct 9 ms 1120 KB Output is correct
33 Correct 9 ms 984 KB Output is correct
34 Correct 9 ms 1104 KB Output is correct
35 Correct 8 ms 1104 KB Output is correct
36 Correct 8 ms 1104 KB Output is correct
37 Correct 8 ms 1024 KB Output is correct
38 Correct 8 ms 1104 KB Output is correct
39 Correct 14 ms 1104 KB Output is correct
40 Correct 8 ms 1104 KB Output is correct
41 Correct 9 ms 1104 KB Output is correct
42 Correct 8 ms 1104 KB Output is correct
43 Correct 8 ms 1104 KB Output is correct
44 Correct 8 ms 1104 KB Output is correct
45 Correct 10 ms 1104 KB Output is correct
46 Correct 8 ms 1104 KB Output is correct
47 Correct 9 ms 1104 KB Output is correct
48 Correct 9 ms 1272 KB Output is correct
49 Correct 9 ms 1116 KB Output is correct
50 Correct 9 ms 1104 KB Output is correct
51 Correct 10 ms 1348 KB Output is correct
52 Correct 9 ms 1240 KB Output is correct
53 Correct 9 ms 1252 KB Output is correct
54 Correct 8 ms 1104 KB Output is correct
55 Correct 9 ms 1104 KB Output is correct
56 Correct 8 ms 1104 KB Output is correct
57 Correct 9 ms 1104 KB Output is correct
58 Correct 9 ms 1116 KB Output is correct
59 Correct 9 ms 1104 KB Output is correct
60 Correct 9 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 504 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 8 ms 4332 KB Output is correct
32 Correct 8 ms 4600 KB Output is correct
33 Correct 8 ms 4504 KB Output is correct
34 Correct 8 ms 4496 KB Output is correct
35 Correct 9 ms 4588 KB Output is correct
36 Correct 8 ms 4840 KB Output is correct
37 Correct 9 ms 4840 KB Output is correct
38 Correct 9 ms 4508 KB Output is correct
39 Correct 8 ms 4844 KB Output is correct
40 Correct 8 ms 4832 KB Output is correct
41 Correct 9 ms 4588 KB Output is correct
42 Correct 10 ms 4588 KB Output is correct
43 Correct 9 ms 4844 KB Output is correct
44 Correct 9 ms 4512 KB Output is correct
45 Correct 9 ms 4492 KB Output is correct
46 Correct 9 ms 1104 KB Output is correct
47 Correct 9 ms 1120 KB Output is correct
48 Correct 9 ms 984 KB Output is correct
49 Correct 9 ms 1104 KB Output is correct
50 Correct 8 ms 1104 KB Output is correct
51 Correct 8 ms 1104 KB Output is correct
52 Correct 8 ms 1024 KB Output is correct
53 Correct 8 ms 1104 KB Output is correct
54 Correct 14 ms 1104 KB Output is correct
55 Correct 8 ms 1104 KB Output is correct
56 Correct 9 ms 1104 KB Output is correct
57 Correct 8 ms 1104 KB Output is correct
58 Correct 8 ms 1104 KB Output is correct
59 Correct 8 ms 1104 KB Output is correct
60 Correct 10 ms 1104 KB Output is correct
61 Correct 8 ms 1104 KB Output is correct
62 Correct 9 ms 1104 KB Output is correct
63 Correct 9 ms 1272 KB Output is correct
64 Correct 9 ms 1116 KB Output is correct
65 Correct 9 ms 1104 KB Output is correct
66 Correct 10 ms 1348 KB Output is correct
67 Correct 9 ms 1240 KB Output is correct
68 Correct 9 ms 1252 KB Output is correct
69 Correct 8 ms 1104 KB Output is correct
70 Correct 9 ms 1104 KB Output is correct
71 Correct 8 ms 1104 KB Output is correct
72 Correct 9 ms 1104 KB Output is correct
73 Correct 9 ms 1116 KB Output is correct
74 Correct 9 ms 1104 KB Output is correct
75 Correct 9 ms 1104 KB Output is correct
76 Correct 114 ms 15992 KB Output is correct
77 Correct 114 ms 16552 KB Output is correct
78 Correct 129 ms 16620 KB Output is correct
79 Correct 122 ms 15988 KB Output is correct
80 Correct 113 ms 16056 KB Output is correct
81 Correct 134 ms 16164 KB Output is correct
82 Correct 117 ms 16000 KB Output is correct
83 Correct 116 ms 16004 KB Output is correct
84 Correct 124 ms 15988 KB Output is correct
85 Correct 120 ms 15992 KB Output is correct
86 Correct 120 ms 16348 KB Output is correct
87 Correct 127 ms 16344 KB Output is correct
88 Correct 116 ms 16412 KB Output is correct
89 Correct 127 ms 15992 KB Output is correct
90 Correct 125 ms 16612 KB Output is correct