Submission #925710

#TimeUsernameProblemLanguageResultExecution timeMemory
925710AmrBliskost (COI23_bliskost)C++14
100 / 100
148 ms16576 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define S second #define F first #define all(x) (x).begin(),(x).end() #define sz size() #define Yes cout << "YES" << endl #define No cout << "NO" << endl #define pb(x) push_back(x); #define endl '\n' #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int N=3e5+7; ll INF=INT_MAX,mod=1e9+7; int TT=1; ll power(ll x, unsigned int y) { ll res = 1; x = x; // % mod; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res*x) ; // % mod; y = y>>1; x = (x*x) ; // % mod; } return res; } string d[] = {"ne","da"}; void solve() { int n , q; cin >> n >> q; string a, b; cin >> a >> b; ll sum = 0; bool bb = !(n&1); for(int i = 0; i < n; i++) { if((i%2)^bb) sum+=int(b[i]-a[i]); else sum-=int(b[i]-a[i]); } cout << d[(abs(sum)%26)==0] << endl; while(q--) { ll x; char c; cin >> x; cin >> c; x--; bool aa = ((x%2)^bb); if(aa) {sum-=int(b[x]-a[x]); a[x] = c; sum+=int(b[x]-a[x]);} else {sum+=int(b[x]-a[x]); a[x] = c; sum-=int(b[x]-a[x]);} cout << d[(abs(sum)%26)==0] << endl; } } int main(){ //freopen("friday.in","r",stdin); //freopen("friday.out","w",stdout); fast; while(TT--) solve(); return 0; }
#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...