135372025-01-08 09:30:43antiSzínezéscpp17Runtime error 0/50699ms564 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;

    int t[n], kar;
    cin >> kar;
    int h=n-1;
    while(kar>0){
        t[h] = kar%10;
        kar /= 10;
        h--;
    }

    int u[q];
    for(int i=0; i<q; i++){
        cin >> u[i];
    }

    int szakadas = 0;
    for(int i=1; i<n; i++){
        if(t[i] != t[i-1])
            szakadas++;
    }
    cout << (szakadas+1)/2 << endl;

    h=0;
    while(h<q){
        t[u[h]-1] = (t[u[h]-1] + 1) % 2;

        int szakadas = 0;
        for(int i=1; i<n; i++){
            if(t[i] != t[i-1])
                szakadas++;
        }
        cout << (szakadas+1)/2 << endl;
        h++;
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms316 KiB
2Runtime error0/012ms508 KiB
3Runtime error0/21ms316 KiB
4Runtime error0/21ms500 KiB
5Runtime error0/31ms316 KiB
6Runtime error0/31ms316 KiB
7Runtime error0/33ms316 KiB
8Runtime error0/33ms564 KiB
9Runtime error0/23ms316 KiB
10Runtime error0/23ms316 KiB
11Time limit exceeded0/3699ms416 KiB
12Time limit exceeded0/3699ms316 KiB
13Time limit exceeded0/3699ms420 KiB
14Time limit exceeded0/3689ms316 KiB
15Time limit exceeded0/3690ms316 KiB
16Time limit exceeded0/3691ms316 KiB
17Time limit exceeded0/3691ms508 KiB
18Time limit exceeded0/3683ms316 KiB
19Time limit exceeded0/3683ms316 KiB
20Time limit exceeded0/3683ms316 KiB