Submission #947291

#TimeUsernameProblemLanguageResultExecution timeMemory
947291SuPythonyBliskost (COI23_bliskost)C++17
57 / 100
1046 ms20272 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(n+1,0), vb(n+1,0); ll sa=0, sb=0; for (int i=1; i<=n; i++) { if (n%2==i%2) { va[i]=a[i-1]-'a'+1; vb[i]=b[i-1]-'a'+1; } else { va[i]=-(a[i-1]-'a'+1); vb[i]=-(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...