Submission #1026489

#TimeUsernameProblemLanguageResultExecution timeMemory
1026489vjudge1Bliskost (COI23_bliskost)C++17
100 / 100
120 ms24396 KiB
#include <bits/stdc++.h> using namespace std; #define int long long void f(){ #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); //f(); int n, q; cin >>n >> q; vector<int> a(n); int sb=0, sa=0; string s, t; cin >> s>> t; int last=0; for(int i=0; i<n; i++){ if(i%2) sa+=(s[i]-t[i]+26)%26; else sb+=(s[i]-t[i]+26)%26; } if((sa%26)==(sb%26)) cout<<"da\n"; else cout<<"ne\n"; while(q--){ int p; cin >> p; p--; char x; cin >> x; if(p%2){ sa-=(s[p]-t[p]+26)%26; s[p]=x; sa+=(s[p]-t[p]+26)%26; } else{ sb-=(s[p]-t[p]+26)%26; s[p]=x; sb+=(s[p]-t[p]+26)%26; } if((sa%26)==(sb%26)) cout<<"da\n"; else cout<<"ne\n"; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:25:6: warning: unused variable 'last' [-Wunused-variable]
   25 |  int last=0;
      |      ^~~~
Main.cpp: In function 'void f()':
Main.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  freopen("in.txt", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  freopen("out.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...