이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
void _(){
int n,q;
cin >> n >> q;
string s,t;
cin >> s >> t;
array<int,2> pre = {0,0};
for(int i = 0 ; i < n; i++){
pre[i&1] += (t[i] - s[i] + 26) % 26;
}
if((n-1)&1){
if((pre[1]-pre[0])%26==0) cout << "da\n";
else cout << "ne\n";
}
else{
if((pre[0]-pre[1])%26==0) cout << "da\n";
else cout << "ne\n";
}
while(q--){
int ind;
char a;
cin >> ind >> a;
ind--;
pre[ind&1]-=(t[ind]-s[ind]+26)%26;
s[ind] = a;
pre[ind&1]+=(t[ind]-s[ind]+26)%26;
if((n-1)&1){
if((pre[1]-pre[0])%26==0) cout << "da\n";
else cout << "ne\n";
}
else{
if((pre[0]-pre[1])%26==0) cout << "da\n";
else cout << "ne\n";
}
}
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int tc=1;//cin >> tc;
while(tc--) _();
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... |