Submission #1019252

#TimeUsernameProblemLanguageResultExecution timeMemory
1019252MarwenElarbiBliskost (COI23_bliskost)C++17
100 / 100
138 ms20452 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define pb push_back #define se second #define fi first #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); const int nax=1e5+5; int main() { optimise; int n,q; cin>>n>>q; string a,b; cin>>a>>b; int tab[n]; for (int i = 0; i < n; ++i) { int cnt = (i ? tab[i-1] : 0); tab[i]=(b[i]-a[i]-cnt+26)%26; } cout << (tab[n-1]==0 ? "da" : "ne")<<'\n'; for (int i = 0; i < q; ++i) { int x; char y; cin>>x>>y; x--; int cnt=y-a[x]; a[x]=y; if((n-x)%2){ tab[n-1]-=cnt; tab[n-1]+=26; tab[n-1]%=26; }else{ tab[n-1]+=cnt; tab[n-1]+=26; tab[n-1]%=26; } cout << (tab[n-1]==0 ? "da" : "ne")<<'\n'; } }
#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...