Submission #954525

# Submission time Handle Problem Language Result Execution time Memory
954525 2024-03-28T06:03:16 Z willychan Bliskost (COI23_bliskost) C++17
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds


string ans[2]={"ne","da"};

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,q;cin>>n>>q;
	string s;cin>>s;
	string b;cin>>b;
	vector<int> arr(n);
	for(int i=0;i<n;i++){
		arr[i] = (b[i]-s[i]);
		if(arr[i]<0) arr[i]+=26;
	}
	vector<int> u(n);
	u[n-1]=1;
	u[n-2]=1;
	for(int j=n-3;j>=0;j--) u[j]=u[j+1]*-1;
	ll sum=0;	
	for(int i=0;i<n-1;i++) sum+=u[i]*arr[i];
	cout<<ans[sum==arr[n-1]]<<"\n";
	for(int i=0;i<q;i++){
		int p;cin>>p;
		p--;
		char x;cin>>x;
		ll og = u[p]*arr[p];
		s[p]=x;
		arr[p] = b[p]-s[p];
		if(arr[p]<0) arr[p]+=26;
		if(p!=n-1){
			sum-=og;
			sum+=u[p]*arr[p];
		}
		cout<<ans[sum==arr[n-1]]<<"\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -