207392026-01-08 18:28:39KoszorusBlankaSzínezéscpp17Wrong answer 0/50419ms2704 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N,Q;
    cin >> N >> Q;

    int db1 = 0, db0=0;
    string S;
    for (int i = 1; i <= N; i++) {
        char s;
        cin >> s;
        S += s;
        if (s == '1') {db1++;}else db0++;
    }

    vector <int> q(Q+1);
    for (int i = 1; i <= Q; i++) {
        cin >> q[i];
    }
    cout << min(db1,db0) << endl;

    for (int i = 0; i < Q; i++) {
        if (S[q[i]] == '0') {
            S[q[i]] = '1';
            db0--; db1++;
        }else {
            S[q[i]] = '0';
            db1--; db0++;
        }
        cout << min(db1, db0) << endl;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms544 KiB
2Wrong answer0/03ms316 KiB
3Wrong answer0/21ms512 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/33ms316 KiB
8Wrong answer0/33ms332 KiB
9Wrong answer0/23ms564 KiB
10Wrong answer0/23ms316 KiB
11Wrong answer0/3419ms2704 KiB
12Wrong answer0/3398ms2576 KiB
13Wrong answer0/3398ms2500 KiB
14Wrong answer0/3414ms2540 KiB
15Wrong answer0/3397ms2496 KiB
16Wrong answer0/3400ms2548 KiB
17Wrong answer0/3416ms2580 KiB
18Wrong answer0/3411ms2536 KiB
19Wrong answer0/3416ms2700 KiB
20Wrong answer0/3395ms2500 KiB