Submission #947295

#TimeUsernameProblemLanguageResultExecution timeMemory
947295SuPythonyBliskost (COI23_bliskost)C++17
57 / 100
1071 ms4876 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; ll sa=0, sb=0; for (int i=1; i<=n; i++) { sa+=(a[i-1]-'a'+1)*(n%2==i%2?1:-1); sb+=(b[i-1]-'a'+1)*(n%2==i%2?1:-1); } if ((sa-sb)%26==0) cout<<"da\n"; else cout<<"ne\n"; while (q--) { int p; char c; cin>>p>>c; int v=(c-'a'+1)*(n%2==p%2?1:-1); sa-=(a[p-1]-'a'+1)*(n%2==p%2?1:-1); a[p-1]=c; sa+=v; 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...