Submission #1290877

#TimeUsernameProblemLanguageResultExecution timeMemory
1290877qweqerBliskost (COI23_bliskost)C++20
0 / 100
1 ms572 KiB
#include <bits/stdc++.h> #define FOR(i, beg, ed, etr) for(ll i = beg;i <= ed;i += etr) #define all(x) x.begin(), x.end() #define F first #define pb push_back #define S second #define con continue using namespace std; typedef long long ll; typedef pair<ll,ll> pii; typedef pair<ll,ll> pll; typedef double db; typedef long double ld; const ll inf = 1e9; const ll INF = 1e18; const ll N = 3e6; const ll MOD = 1e9 + 7; ll a[N],b[N]; void solve(){ int n,q ;cin >> n >> q; int x = 0; FOR(i, 1, n , 1){ char c;cin >> c; a[i] = (c - 'a' + 1); if(i == n)x += a[i]; else if((n - i) % 2 == 0){ x += (a[i] - 1); } else{ x -= (a[i] - 1); } } int y = 0; FOR(i, 1, n, 1){ char c;cin >> c; b[i] = (c - 'a' + 1); if(i == n)y += b[i]; else if((n - i) % 2 == 0){ y += (b[i] - 1); } else{ y -= (b[i] - 1); } } if((x % 26) == (y % 26)){ cout << "da\n"; } else cout << "ne\n"; while(q--){ int pos; char c;cin >> pos>>c; if(n == pos){ x -= a[pos]; } else if((n - pos) % 2 == 0){ x -= (a[pos] - 1); } else{ x += (a[pos] - 1); } a[pos] = (c - 'a' + 1); if(n == pos){ x += a[pos]; } else if((n - pos) % 2 == 0){ x += (a[pos] - 1); } else{ x -= (a[pos] - 1); } if((x % 26) == (y % 26)){ cout << "da\n"; } else cout << "ne\n"; } } main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll abd = 1; // cin >> abd; FOR(i, 1, abd, 1){ solve(); } }

Compilation message (stderr)

Main.cpp:78:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   78 | main(){
      | ^~~~
#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...