답안 #1041355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041355 2024-08-01T22:34:30 Z elotelo966 Bliskost (COI23_bliskost) C++17
100 / 100
126 ms 25884 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2512 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 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 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2512 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 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 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 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 0 ms 2396 KB Output is correct
22 Correct 1 ms 2392 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 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 1 ms 2396 KB Output is correct
28 Correct 0 ms 2448 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2512 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 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 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 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 0 ms 2396 KB Output is correct
22 Correct 1 ms 2392 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 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 1 ms 2396 KB Output is correct
28 Correct 0 ms 2448 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 8 ms 13708 KB Output is correct
32 Correct 8 ms 13764 KB Output is correct
33 Correct 8 ms 13656 KB Output is correct
34 Correct 8 ms 13632 KB Output is correct
35 Correct 8 ms 13708 KB Output is correct
36 Correct 8 ms 14092 KB Output is correct
37 Correct 8 ms 14192 KB Output is correct
38 Correct 8 ms 13748 KB Output is correct
39 Correct 8 ms 14016 KB Output is correct
40 Correct 8 ms 14056 KB Output is correct
41 Correct 8 ms 13720 KB Output is correct
42 Correct 8 ms 13836 KB Output is correct
43 Correct 8 ms 14072 KB Output is correct
44 Correct 8 ms 13664 KB Output is correct
45 Correct 8 ms 13720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2512 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 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 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 7 ms 3164 KB Output is correct
17 Correct 7 ms 3164 KB Output is correct
18 Correct 7 ms 3416 KB Output is correct
19 Correct 7 ms 3164 KB Output is correct
20 Correct 7 ms 3164 KB Output is correct
21 Correct 7 ms 3164 KB Output is correct
22 Correct 7 ms 3164 KB Output is correct
23 Correct 7 ms 3164 KB Output is correct
24 Correct 7 ms 3164 KB Output is correct
25 Correct 7 ms 3164 KB Output is correct
26 Correct 8 ms 3160 KB Output is correct
27 Correct 7 ms 3164 KB Output is correct
28 Correct 7 ms 3164 KB Output is correct
29 Correct 7 ms 3164 KB Output is correct
30 Correct 7 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2512 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 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 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 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 0 ms 2396 KB Output is correct
22 Correct 1 ms 2392 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 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 1 ms 2396 KB Output is correct
28 Correct 0 ms 2448 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 7 ms 3164 KB Output is correct
32 Correct 7 ms 3164 KB Output is correct
33 Correct 7 ms 3416 KB Output is correct
34 Correct 7 ms 3164 KB Output is correct
35 Correct 7 ms 3164 KB Output is correct
36 Correct 7 ms 3164 KB Output is correct
37 Correct 7 ms 3164 KB Output is correct
38 Correct 7 ms 3164 KB Output is correct
39 Correct 7 ms 3164 KB Output is correct
40 Correct 7 ms 3164 KB Output is correct
41 Correct 8 ms 3160 KB Output is correct
42 Correct 7 ms 3164 KB Output is correct
43 Correct 7 ms 3164 KB Output is correct
44 Correct 7 ms 3164 KB Output is correct
45 Correct 7 ms 3164 KB Output is correct
46 Correct 9 ms 3160 KB Output is correct
47 Correct 9 ms 3160 KB Output is correct
48 Correct 8 ms 3420 KB Output is correct
49 Correct 10 ms 3228 KB Output is correct
50 Correct 8 ms 3352 KB Output is correct
51 Correct 8 ms 3164 KB Output is correct
52 Correct 8 ms 3164 KB Output is correct
53 Correct 8 ms 3164 KB Output is correct
54 Correct 8 ms 3164 KB Output is correct
55 Correct 8 ms 3164 KB Output is correct
56 Correct 8 ms 3160 KB Output is correct
57 Correct 8 ms 3164 KB Output is correct
58 Correct 8 ms 3364 KB Output is correct
59 Correct 8 ms 3164 KB Output is correct
60 Correct 8 ms 3400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2512 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 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 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 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 0 ms 2396 KB Output is correct
22 Correct 1 ms 2392 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 0 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 1 ms 2396 KB Output is correct
28 Correct 0 ms 2448 KB Output is correct
29 Correct 0 ms 2396 KB Output is correct
30 Correct 0 ms 2396 KB Output is correct
31 Correct 8 ms 13708 KB Output is correct
32 Correct 8 ms 13764 KB Output is correct
33 Correct 8 ms 13656 KB Output is correct
34 Correct 8 ms 13632 KB Output is correct
35 Correct 8 ms 13708 KB Output is correct
36 Correct 8 ms 14092 KB Output is correct
37 Correct 8 ms 14192 KB Output is correct
38 Correct 8 ms 13748 KB Output is correct
39 Correct 8 ms 14016 KB Output is correct
40 Correct 8 ms 14056 KB Output is correct
41 Correct 8 ms 13720 KB Output is correct
42 Correct 8 ms 13836 KB Output is correct
43 Correct 8 ms 14072 KB Output is correct
44 Correct 8 ms 13664 KB Output is correct
45 Correct 8 ms 13720 KB Output is correct
46 Correct 7 ms 3164 KB Output is correct
47 Correct 7 ms 3164 KB Output is correct
48 Correct 7 ms 3416 KB Output is correct
49 Correct 7 ms 3164 KB Output is correct
50 Correct 7 ms 3164 KB Output is correct
51 Correct 7 ms 3164 KB Output is correct
52 Correct 7 ms 3164 KB Output is correct
53 Correct 7 ms 3164 KB Output is correct
54 Correct 7 ms 3164 KB Output is correct
55 Correct 7 ms 3164 KB Output is correct
56 Correct 8 ms 3160 KB Output is correct
57 Correct 7 ms 3164 KB Output is correct
58 Correct 7 ms 3164 KB Output is correct
59 Correct 7 ms 3164 KB Output is correct
60 Correct 7 ms 3164 KB Output is correct
61 Correct 9 ms 3160 KB Output is correct
62 Correct 9 ms 3160 KB Output is correct
63 Correct 8 ms 3420 KB Output is correct
64 Correct 10 ms 3228 KB Output is correct
65 Correct 8 ms 3352 KB Output is correct
66 Correct 8 ms 3164 KB Output is correct
67 Correct 8 ms 3164 KB Output is correct
68 Correct 8 ms 3164 KB Output is correct
69 Correct 8 ms 3164 KB Output is correct
70 Correct 8 ms 3164 KB Output is correct
71 Correct 8 ms 3160 KB Output is correct
72 Correct 8 ms 3164 KB Output is correct
73 Correct 8 ms 3364 KB Output is correct
74 Correct 8 ms 3164 KB Output is correct
75 Correct 8 ms 3400 KB Output is correct
76 Correct 106 ms 25548 KB Output is correct
77 Correct 104 ms 25828 KB Output is correct
78 Correct 113 ms 25508 KB Output is correct
79 Correct 102 ms 25472 KB Output is correct
80 Correct 105 ms 25380 KB Output is correct
81 Correct 103 ms 25420 KB Output is correct
82 Correct 126 ms 25316 KB Output is correct
83 Correct 110 ms 25480 KB Output is correct
84 Correct 106 ms 25472 KB Output is correct
85 Correct 120 ms 25472 KB Output is correct
86 Correct 105 ms 25832 KB Output is correct
87 Correct 105 ms 25820 KB Output is correct
88 Correct 106 ms 25884 KB Output is correct
89 Correct 107 ms 25472 KB Output is correct
90 Correct 103 ms 25816 KB Output is correct