Submission #1026772

# Submission time Handle Problem Language Result Execution time Memory
1026772 2024-07-18T10:56:39 Z vjudge1 Bliskost (COI23_bliskost) C++17
28 / 100
94 ms 5616 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;

  	//cout<<(int)(yedek[0]-'a')+1<<" ";
  	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;
  	//cout<<str[n-1]<<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;
  		//cout<<son<<endl;
  		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 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 452 KB Output is correct
19 Correct 0 ms 344 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 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 452 KB Output is correct
19 Correct 0 ms 344 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 46 ms 4924 KB Output is correct
32 Correct 49 ms 5108 KB Output is correct
33 Correct 48 ms 4956 KB Output is correct
34 Correct 46 ms 4984 KB Output is correct
35 Correct 44 ms 4744 KB Output is correct
36 Correct 45 ms 5616 KB Output is correct
37 Correct 47 ms 5272 KB Output is correct
38 Correct 46 ms 4752 KB Output is correct
39 Correct 44 ms 5384 KB Output is correct
40 Correct 44 ms 5332 KB Output is correct
41 Correct 45 ms 4748 KB Output is correct
42 Correct 45 ms 4956 KB Output is correct
43 Correct 45 ms 5480 KB Output is correct
44 Correct 47 ms 4772 KB Output is correct
45 Correct 46 ms 5020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Incorrect 94 ms 1104 KB Output isn't correct
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 452 KB Output is correct
19 Correct 0 ms 344 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 94 ms 1104 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 456 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 460 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 452 KB Output is correct
19 Correct 0 ms 344 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 46 ms 4924 KB Output is correct
32 Correct 49 ms 5108 KB Output is correct
33 Correct 48 ms 4956 KB Output is correct
34 Correct 46 ms 4984 KB Output is correct
35 Correct 44 ms 4744 KB Output is correct
36 Correct 45 ms 5616 KB Output is correct
37 Correct 47 ms 5272 KB Output is correct
38 Correct 46 ms 4752 KB Output is correct
39 Correct 44 ms 5384 KB Output is correct
40 Correct 44 ms 5332 KB Output is correct
41 Correct 45 ms 4748 KB Output is correct
42 Correct 45 ms 4956 KB Output is correct
43 Correct 45 ms 5480 KB Output is correct
44 Correct 47 ms 4772 KB Output is correct
45 Correct 46 ms 5020 KB Output is correct
46 Incorrect 94 ms 1104 KB Output isn't correct
47 Halted 0 ms 0 KB -