Submission #1026776

# Submission time Handle Problem Language Result Execution time Memory
1026776 2024-07-18T10:58:27 Z vjudge1 Bliskost (COI23_bliskost) C++17
28 / 100
50 ms 3832 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
#define endl '\n'
#define N 150100
#define M 15
#define big 2147483647 
#define bigg 9223372036854775807 
#define pb push_back
#define p push
#define ins insert
#define f first
int farr(char a,char b){ //(a->b yol)
	if(a==b)return 0;
	if((int)a<(int)b) return ((int)b-(int)a);
	return (int)b-'a'+(int)('z'-a)+1;
}
int indir(int x,int y){
	while(y--){
		if(x==0)x=M-1;
		else x--;
	}
	return x;
}
signed main(){
  	lalala;
  	int n,q;cin>>n>>q;
  	string str,hedef;cin>>str>>hedef;
  	string yedek=str;

  	for(int i=0;i<(int)yedek.size()-1;i++){
  		while(yedek[i]!=hedef[i]){
  			if(yedek[i]=='z')yedek[i]='a';
  			else yedek[i]++;
  			if(yedek[i+1]=='z')yedek[i+1]='a';
  			else yedek[i+1]++;
  		}
  	}

  	if(yedek[n-1]!=hedef[n-1])cout<<"ne"<<endl;
  	else cout<<"da"<<endl;
  	int son=yedek[n-1]-'a',hedefim=hedef[n-1]-'a';
  	while(q--){
  		int x;char a;cin>>x>>a;
  		x--;
  		int fark1=farr(str[x],hedef[x]), fark2=farr(a,hedef[x]);
  		str[x]=a;
  		int fark;

  		if(fark1>=fark2){
  				fark=fark1-fark2;
  				if(((x+1)%2)==(n%2))son=(son+fark)%M;
  				else son=indir(son,fark);
  		}
  		else{
  			fark=fark2-fark1;
  			if(((x+1)%2)==(n%2))son=indir(son,fark);
  			else son=(son+fark)%M;

  		}
  		//cout<<son<<" "<<fark1<<" "<<fark2<<" "<<fark<<endl;
  		if(son==hedefim) cout<<"da"<<endl;
  		else cout<<"ne"<<endl;



  	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 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 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 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 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 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 47 ms 3468 KB Output is correct
32 Correct 50 ms 3464 KB Output is correct
33 Correct 47 ms 3488 KB Output is correct
34 Correct 47 ms 3484 KB Output is correct
35 Correct 47 ms 3464 KB Output is correct
36 Correct 47 ms 3828 KB Output is correct
37 Correct 47 ms 3824 KB Output is correct
38 Correct 47 ms 3484 KB Output is correct
39 Correct 47 ms 3828 KB Output is correct
40 Correct 47 ms 3816 KB Output is correct
41 Correct 47 ms 3480 KB Output is correct
42 Correct 49 ms 3464 KB Output is correct
43 Correct 47 ms 3832 KB Output is correct
44 Correct 47 ms 3496 KB Output is correct
45 Correct 50 ms 3480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Incorrect 10 ms 600 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 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 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 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 Incorrect 10 ms 600 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 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 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 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 47 ms 3468 KB Output is correct
32 Correct 50 ms 3464 KB Output is correct
33 Correct 47 ms 3488 KB Output is correct
34 Correct 47 ms 3484 KB Output is correct
35 Correct 47 ms 3464 KB Output is correct
36 Correct 47 ms 3828 KB Output is correct
37 Correct 47 ms 3824 KB Output is correct
38 Correct 47 ms 3484 KB Output is correct
39 Correct 47 ms 3828 KB Output is correct
40 Correct 47 ms 3816 KB Output is correct
41 Correct 47 ms 3480 KB Output is correct
42 Correct 49 ms 3464 KB Output is correct
43 Correct 47 ms 3832 KB Output is correct
44 Correct 47 ms 3496 KB Output is correct
45 Correct 50 ms 3480 KB Output is correct
46 Incorrect 10 ms 600 KB Output isn't correct
47 Halted 0 ms 0 KB -