Submission #954521

#TimeUsernameProblemLanguageResultExecution timeMemory
954521becaidoBliskost (COI23_bliskost)C++17
100 / 100
128 ms16120 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,popcnt,sse4,abm") #include <bits/stdc++.h> using namespace std; #ifdef WAIMAI #define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE) void dout() {cout << '\n';} template<typename T, typename...U> void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);} #else #define debug(...) 7122 #endif #define ll long long #define Waimai ios::sync_with_stdio(false), cin.tie(0) #define FOR(x,a,b) for (int x = a, I = b; x <= I; x++) #define pb emplace_back #define F first #define S second const int SIZE = 1e6 + 5; int n, q; ll sum; string a, b; int cal(int i) { return ((i & 1) ? b[i] - a[i] : a[i] - b[i]); } void solve() { cin >> n >> q >> a >> b; a = " " + a; b = " " + b; FOR (i, 1, n) sum += cal(i); cout << (sum % 26 == 0 ? "da\n" : "ne\n"); while (q--) { int p; char c; cin >> p >> c; sum -= cal(p); a[p] = c; sum += cal(p); cout << (sum % 26 == 0 ? "da\n" : "ne\n"); } } int main() { Waimai; solve(); }
#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...