제출 #1309696

#제출 시각아이디문제언어결과실행 시간메모리
1309696quollcucumber`Bliskost (COI23_bliskost)C++20
0 / 100
1 ms568 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    int n, q;
    cin >> n >> q;
    string a, b;
    cin >> a >> b;
    if(n == 1) {
        assert(1==2);
        if(a == b) {
            cout<<"da\n";
        }else {
            cout<<"ne\n";
        }
        for(int i = 0; i < q; i++) {
            int pos;
            char c;
            cin >> pos >> c;
            a[pos-1] = c;
            if(a == b) {
                cout<<"da\n";
            }else {
                cout<<"ne\n";
            }
        }
    }else if(n == 2) {
        assert(1==2);
        bool works = false;
        for(int i = 0; i < 26; i++) {
            if(a[0] + i == b[0] && a[1] + i == b[1]) {
                works = true;
            }
        }
        if(works) {
            cout<<"da\n";
        }else {
            cout<<"na\n";
        }
        for(int j = 0; j < q; j++) {
            int pos;
            char c;
            cin >> pos >> c;
            a[pos-1] = c;
            works = false;
            for(int i = 0; i < 26; i++) {
                if(a[0] + i == b[0] && a[1] + i == b[1]) {
                    works = true;
                }
            }
            if(works) {
                cout<<"da\n";
            }else {
                cout<<"na\n";
            }
        }
    }else {
        assert(n != 3);
        int dif = 0;
        for(int i = 0 ; i < n; i++) {
            dif += abs(a[i] - b[i]);
        }
        dif = dif % 2;
        // int moda = 0, modb = 0;
        // for(char i : a) {
        //     moda += i;
        //     // moda%= 2;
        // }
        // for(char i : b) {
        //     modb += i;
        //     // modb %= 2;
        // }
        // moda = moda % 2;
        // modb = modb % 2;
        if(dif == 0) {
            cout<<"da\n";
        }else {
            cout<<"ne\n";
        }
        for(int i = 0; i < q; i++) {
            assert(1 == 2);
            // int pos;
            // char c;
            // cin >> pos >> c;
            // if((a[pos-1] - 'a') % 2 != (c - 'a') % 2) {
            //     moda = 1 ^ moda;
            // }
            // a[pos-1] = c;
            // if(moda == modb) {
            //     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...