Submission #1019244

#TimeUsernameProblemLanguageResultExecution timeMemory
1019244MarwenElarbiBliskost (COI23_bliskost)C++17
57 / 100
1063 ms8592 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")<<endl; for (int i = 0; i < q; ++i) { int x; char y; cin>>x>>y; x--; a[x]=y; tab[x]=(-(x ? tab[x-1] : 0)+b[x]-a[x]+26)%26; for (int j = x+1; j < n; ++j) { tab[j]=(b[j]-a[j]-tab[j-1]+26)%26; //cout <<tab[j]<<" "; }//cout <<endl; cout << (tab[n-1]==0 ? "da" : "ne")<<endl; } }
#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...