Submission #997810

#TimeUsernameProblemLanguageResultExecution timeMemory
997810cpdreamerBliskost (COI23_bliskost)C++17
57 / 100
1070 ms4896 KiB
#include <bits/stdc++.h> #include <climits> #include <ext/pb_ds/assoc_container.hpp> #include <utility> using namespace __gnu_pbds; using namespace std; void solve(){ int n, q; cin >> n >> q; string a, b; cin >> a >> b; string x = a, y = b; for(int i = 0; i <= q; i++){ if(i){ int p; cin >> p; p--; char c; cin >> c; x[p] = c; a=x; b=y; } for(int i = n-1; i > 0; i--){ if(a[i] <= b[i]){ int d = b[i]-a[i]; a[i] = b[i]; a[i-1] = char( ((a[i-1] -'a'+d)%26) + 'a'); }else{ int d = a[i]-b[i]; b[i] = a[i]; b[i-1] = char( ((b[i-1] -'a'+d)%26) + 'a'); } } cout << (a==b?"da":"ne") << '\n'; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //file(); solve(); 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...