Submission #1019241

#TimeUsernameProblemLanguageResultExecution timeMemory
1019241MarwenElarbiBliskost (COI23_bliskost)C++17
0 / 100
2 ms604 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() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif 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]=(-(i ? 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; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:12:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...