This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |