Submission #1322571

#TimeUsernameProblemLanguageResultExecution timeMemory
1322571pastaBliskost (COI23_bliskost)C++20
40 / 100
90 ms4256 KiB
//Oh? You're Approaching Me? #include <bits/stdc++.h> using namespace std; // #define int long long typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; // #pragma GCC optimize("O3,unroll-loops") #define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define pb push_back #define F first #define S second #define SZ(x) ll((x).size()) #define all(x) (x).begin(), (x).end() #define cl clear #define endl '\n' #define deb(x) cerr << #x << " = " << x << '\n' #define dokme(x) {cout << x << endl; return;} #define wtf cout << "[ahaaaaaaaaaaaaaaaa]" << endl; const int maxn = 1e6 + 10; const int mod = 998244353; const int inf = 1e18 + 5; const int LOG = 31; #define mid ((l + r) / 2) #define lc (id * 2) #define rc (lc + 1) //g++ main.cpp -o main && main.exe int n, q; string s1, s2; signed main() { cin >> n >> q; cin >> s1 >> s2; int val1 = 0, val2 = 0; s1 = '!' + s1; s2 = '!' + s2; for (int i =1 ; i <= n; i++) { if (i & 1) val2 += s2[i]; else val2 -= s2[i]; (val2 += 26) %= 26; if (i & 1) val1 += s1[i]; else val1 -= s1[i]; (val1 += 26) %= 26; } if (val1 == val2) cout << "da" << '\n'; else cout << "ne" << '\n'; while (q--) { int i; char c; cin >> i >> c; if (i & 1) { val1 -= s1[i]; s1[i] = c; val1 += s1[i]; } else { val1 += s1[i]; s1[i] = c; val1 -= s1[i]; } (val1 += 26) %= 26; if (val1 == val2) cout << "da" << '\n'; else cout << "ne" << '\n'; } }
#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...