Submission #919761

#TimeUsernameProblemLanguageResultExecution timeMemory
919761ErJBliskost (COI23_bliskost)C++17
57 / 100
1048 ms12452 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vector<ll>> #define vs vector<string> #define vc vector<char> #define vb vector<bool> #define vp vector<pair<ll, ll>> #define pp pair<ll, ll> #define qi queue<ll> #define qp queue<pp> #define pqi priority_queue<ll> #define pqp priority_queue<pp> #define mi map<ll, ll> #define mpi map<pp, ll> #define mip map<ll, pp> #define mpp map<pp, pp> #define mb map<ll, bool> #define si set<ll> #define sp set<pp> #define mod 1000000007 #define rep(a, b) for(int a = 0; a < (b); a++) #define inf 1000000000000000000 int main() { int n, q; cin >> n >> q; string s1, s2; cin >> s1 >> s2; ll odd = 0; ll even = 0; for (int i = 0; i < n; i++) { if (i % 2 == 0) { even += (int) s1[i] - (int) s2[i]; } else { odd += (int)s1[i] - (int)s2[i]; } } if ((even - odd) % 26 == 0) { cout << "da" << endl; } else { cout << "ne" << endl; } while (q--) { int a; char ch; cin >> a >> ch; a--; if (a % 2 == 0) { even -= ((int)s1[a] - (int)s2[a]); s1[a] = ch; even += ((int)s1[a] - (int)s2[a]); } else { odd -= ((int)s1[a] - (int)s2[a]); s1[a] = ch; odd += ((int)s1[a] - (int)s2[a]); } if ((even - odd) % 26 == 0) { cout << "da" << endl; } else { cout << "ne" << endl; } } }
#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...