Submission #1013269

#TimeUsernameProblemLanguageResultExecution timeMemory
1013269amine_arouaBliskost (COI23_bliskost)C++17
57 / 100
1006 ms12260 KiB
#include <bits/stdc++.h> //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") using namespace std; #define int long long #define nl '\n' #define pb push_back signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n , q; cin>>n>>q; string s , t; cin>>s>>t; s = '.' + s; t = '.' + t; vector<int> a(n); a[0] = 0; for(int i = 1 ; i <= n - 1 ; i++) { a[i] = (t[i] - s[i] - a[i - 1] + 2 * 26)%26; } if(a[n - 1] == (t[n] - s[n] + 26)%26) cout<<"da"<<nl; else cout<<"ne"<<nl; while(q--) { int i; char c; cin>>i>>c; int diff = (s[i] - c + 26)%26; s[i] = c; for(int j = i ; j <= n - 1 ; j++) { if((j - i)%2 == 0) { a[j] = (a[j] + diff)%26; } else { a[j] = (a[j] - diff + 26)%26; } } if(a[n - 1] == (t[n] - s[n] + 26)%26) cout<<"da"<<nl; else cout<<"ne"<<nl; } }
#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...