Submission #947288

#TimeUsernameProblemLanguageResultExecution timeMemory
947288SuPythonyBliskost (COI23_bliskost)C++17
57 / 100
1040 ms21296 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n,q; cin>>n>>q; string a,b; cin>>a>>b; vector<ll> va, vb; va.push_back(0ll); vb.push_back(0ll); ll sa=0, sb=0; for (int i=1; i<=n; i++) { if (n%2==i%2) { va.push_back(a[i-1]-'a'+1); vb.push_back(b[i-1]-'a'+1); } else { va.push_back(-(a[i-1]-'a'+1)); vb.push_back(-(b[i-1]-'a'+1)); } sa+=va[i]; sb+=vb[i]; } if ((sa-sb)%26==0) cout<<"da\n"; else cout<<"ne\n"; while (q--) { int p; char c; cin>>p>>c; int a=c-'a'+1; sa-=va[p]; if (n%2==p%2) va[p]=a; else va[p]=-a; sa+=va[p]; if ((sa-sb)%26==0) cout<<"da\n"; else cout<<"ne\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...