제출 #1212081

#제출 시각아이디문제언어결과실행 시간메모리
1212081rhm_ganBliskost (COI23_bliskost)C++20
0 / 100
0 ms320 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q;
    cin >> n >> q;

    string a, b;
    cin >> a >> b;

    int ax = 0, ay = 0;
    int bx = 0, by = 0;
    for (int i = 0; i < n; i++) {
        if (i & 1) {
            ax += a[i];
            bx += b[i];
        }
        else {
            ay += a[i];
            by += b[i];
        }
    }

    if ((ax - bx) % 26 == (ay - by) % 26) {
        cout << "da\n";
    }
    else {
        cout << "ne\n";
    }

    while (q--) {
        int i;
        char c;
        cin >> i >> c;
        i--;
        if (i & 1) {
            ax = ax - a[i] + c;
        }
        else {
            ay = ay - a[i] + c;
        }
        a[i] = c;
        if ((ax - bx) % 26 == (ay - by) % 26) {
            cout << "da\n";
        }
        else {
            cout << "ne\n";
        }
    }

    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...