Submission #1026603

# Submission time Handle Problem Language Result Execution time Memory
1026603 2024-07-18T08:32:51 Z vjudge1 Bliskost (COI23_bliskost) C++17
100 / 100
162 ms 15156 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define OYY LLONG_MAX
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 1000005
#define fi first
#define se second

int dizi[lim];

int pre[lim]; // gereksiz

int32_t main(){
	faster
	int n,q;cin>>n>>q;
	string a,b;cin>>a>>b;
	int bir=0,iki=0;
	FOR{
		dizi[i]=b[i-1]-a[i-1];
		if(i&1)bir+=dizi[i];
		else iki+=dizi[i];
		bir+=26;
		iki+=26;
		bir%=26;
		iki%=26;
	}
	
	if(bir==iki){
		cout<<"da"<<'\n';
	}
	else cout<<"ne"<<'\n';
	
	while(q--){
		int pos;char c;
		cin>>pos>>c;
		a[pos-1]=c;
		if(pos&1){
			bir-=dizi[pos];
			bir=(bir+26)%26;
			dizi[pos]=b[pos-1]-a[pos-1];
			bir+=dizi[pos]+26;
			bir=bir%26;
		}
		else{
			iki-=dizi[pos];
			iki=(iki+26)%26;
			dizi[pos]=b[pos-1]-a[pos-1];
			iki+=dizi[pos]+26;
			iki=(iki%26);
		}
		if(bir==iki){
			cout<<"da"<<'\n';
		}
		else cout<<"ne"<<'\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2392 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2392 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 9 ms 11660 KB Output is correct
32 Correct 9 ms 11660 KB Output is correct
33 Correct 11 ms 11680 KB Output is correct
34 Correct 10 ms 11784 KB Output is correct
35 Correct 9 ms 11656 KB Output is correct
36 Correct 9 ms 12176 KB Output is correct
37 Correct 12 ms 12016 KB Output is correct
38 Correct 9 ms 11672 KB Output is correct
39 Correct 12 ms 12024 KB Output is correct
40 Correct 12 ms 12264 KB Output is correct
41 Correct 12 ms 11668 KB Output is correct
42 Correct 9 ms 11660 KB Output is correct
43 Correct 9 ms 12220 KB Output is correct
44 Correct 12 ms 11692 KB Output is correct
45 Correct 10 ms 11672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 8 ms 2648 KB Output is correct
17 Correct 8 ms 2648 KB Output is correct
18 Correct 8 ms 2732 KB Output is correct
19 Correct 8 ms 2648 KB Output is correct
20 Correct 13 ms 2664 KB Output is correct
21 Correct 8 ms 2588 KB Output is correct
22 Correct 8 ms 2652 KB Output is correct
23 Correct 8 ms 2800 KB Output is correct
24 Correct 8 ms 2648 KB Output is correct
25 Correct 9 ms 2652 KB Output is correct
26 Correct 12 ms 2652 KB Output is correct
27 Correct 9 ms 2652 KB Output is correct
28 Correct 8 ms 2648 KB Output is correct
29 Correct 12 ms 2652 KB Output is correct
30 Correct 9 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2392 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 8 ms 2648 KB Output is correct
32 Correct 8 ms 2648 KB Output is correct
33 Correct 8 ms 2732 KB Output is correct
34 Correct 8 ms 2648 KB Output is correct
35 Correct 13 ms 2664 KB Output is correct
36 Correct 8 ms 2588 KB Output is correct
37 Correct 8 ms 2652 KB Output is correct
38 Correct 8 ms 2800 KB Output is correct
39 Correct 8 ms 2648 KB Output is correct
40 Correct 9 ms 2652 KB Output is correct
41 Correct 12 ms 2652 KB Output is correct
42 Correct 9 ms 2652 KB Output is correct
43 Correct 8 ms 2648 KB Output is correct
44 Correct 12 ms 2652 KB Output is correct
45 Correct 9 ms 2648 KB Output is correct
46 Correct 9 ms 2648 KB Output is correct
47 Correct 9 ms 2808 KB Output is correct
48 Correct 9 ms 2652 KB Output is correct
49 Correct 13 ms 2652 KB Output is correct
50 Correct 9 ms 2648 KB Output is correct
51 Correct 9 ms 2652 KB Output is correct
52 Correct 9 ms 2652 KB Output is correct
53 Correct 16 ms 2652 KB Output is correct
54 Correct 9 ms 2652 KB Output is correct
55 Correct 9 ms 2616 KB Output is correct
56 Correct 9 ms 2648 KB Output is correct
57 Correct 9 ms 2652 KB Output is correct
58 Correct 9 ms 2652 KB Output is correct
59 Correct 9 ms 2648 KB Output is correct
60 Correct 17 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2392 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 0 ms 2396 KB Output is correct
27 Correct 0 ms 2392 KB Output is correct
28 Correct 0 ms 2396 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 9 ms 11660 KB Output is correct
32 Correct 9 ms 11660 KB Output is correct
33 Correct 11 ms 11680 KB Output is correct
34 Correct 10 ms 11784 KB Output is correct
35 Correct 9 ms 11656 KB Output is correct
36 Correct 9 ms 12176 KB Output is correct
37 Correct 12 ms 12016 KB Output is correct
38 Correct 9 ms 11672 KB Output is correct
39 Correct 12 ms 12024 KB Output is correct
40 Correct 12 ms 12264 KB Output is correct
41 Correct 12 ms 11668 KB Output is correct
42 Correct 9 ms 11660 KB Output is correct
43 Correct 9 ms 12220 KB Output is correct
44 Correct 12 ms 11692 KB Output is correct
45 Correct 10 ms 11672 KB Output is correct
46 Correct 8 ms 2648 KB Output is correct
47 Correct 8 ms 2648 KB Output is correct
48 Correct 8 ms 2732 KB Output is correct
49 Correct 8 ms 2648 KB Output is correct
50 Correct 13 ms 2664 KB Output is correct
51 Correct 8 ms 2588 KB Output is correct
52 Correct 8 ms 2652 KB Output is correct
53 Correct 8 ms 2800 KB Output is correct
54 Correct 8 ms 2648 KB Output is correct
55 Correct 9 ms 2652 KB Output is correct
56 Correct 12 ms 2652 KB Output is correct
57 Correct 9 ms 2652 KB Output is correct
58 Correct 8 ms 2648 KB Output is correct
59 Correct 12 ms 2652 KB Output is correct
60 Correct 9 ms 2648 KB Output is correct
61 Correct 9 ms 2648 KB Output is correct
62 Correct 9 ms 2808 KB Output is correct
63 Correct 9 ms 2652 KB Output is correct
64 Correct 13 ms 2652 KB Output is correct
65 Correct 9 ms 2648 KB Output is correct
66 Correct 9 ms 2652 KB Output is correct
67 Correct 9 ms 2652 KB Output is correct
68 Correct 16 ms 2652 KB Output is correct
69 Correct 9 ms 2652 KB Output is correct
70 Correct 9 ms 2616 KB Output is correct
71 Correct 9 ms 2648 KB Output is correct
72 Correct 9 ms 2652 KB Output is correct
73 Correct 9 ms 2652 KB Output is correct
74 Correct 9 ms 2648 KB Output is correct
75 Correct 17 ms 2652 KB Output is correct
76 Correct 135 ms 14672 KB Output is correct
77 Correct 123 ms 15072 KB Output is correct
78 Correct 123 ms 14812 KB Output is correct
79 Correct 123 ms 14668 KB Output is correct
80 Correct 134 ms 14868 KB Output is correct
81 Correct 143 ms 14724 KB Output is correct
82 Correct 118 ms 14632 KB Output is correct
83 Correct 120 ms 14728 KB Output is correct
84 Correct 152 ms 14688 KB Output is correct
85 Correct 155 ms 14848 KB Output is correct
86 Correct 121 ms 15076 KB Output is correct
87 Correct 162 ms 15064 KB Output is correct
88 Correct 125 ms 15144 KB Output is correct
89 Correct 162 ms 14840 KB Output is correct
90 Correct 119 ms 15156 KB Output is correct