Submission #1114015

#TimeUsernameProblemLanguageResultExecution timeMemory
1114015SalihSahinBliskost (COI23_bliskost)C++14
100 / 100
220 ms24348 KiB
#include <bits/stdc++.h> #define pb push_back #define int long long using namespace std; const int inf = 1e9 + 10; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, q; cin>>n>>q; string a, b; cin>>a>>b; vector<int> delt(n), tot(2); for(int i = 0; i < n; i++){ delt[i] = a[i] - b[i]; if(delt[i] < 0) delt[i] += 26; tot[i%2] = (tot[i%2] + delt[i])%26; } if(tot[0] == tot[1]) cout<<"da"<<"\n"; else cout<<"ne"<<"\n"; while(q--){ int ind; char c; cin>>ind>>c; ind--; tot[ind%2] -= delt[ind]; tot[ind%2] = (tot[ind%2] + 26)%26; a[ind] = c; delt[ind] = a[ind] - b[ind]; if(delt[ind] < 0) delt[ind] += 26; tot[ind%2] += delt[ind]; tot[ind%2] %= 26; if(tot[0] == tot[1]) 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...