142912025-01-10 11:56:29ruffbrigiSzínezéscpp17Wrong answer 0/50699ms808 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,q,a=0,b=0,x;
    cin>>n>>q;
    string H,H2;
    cin>>H;
    H=" "+H;
    H2=H;
    int mo[q+1];
    for(int i=2;i<=n;i++)
    {
        if(H[i-1]!=H[i])
        {
            a++;
        }
    }
    for(int i=1;i<=q;i++)
    {
        b=0;
        cin>>x;
        if(H2[x]=='0') H[x]='1';
        else H[x]='0';
        for(int j=2;j<=n;j++)
        {
            if(H[j-1]!=H[j])
            {
                b++;
            }
        }
        H=H2;
        mo[i]=(b+1)/2;
    }
    cout<<(a+1)/2<<endl;
    for(int i=1;i<=q;i++)
    {
        cout<<mo[i]<<endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms316 KiB
2Wrong answer0/017ms436 KiB
3Wrong answer0/21ms508 KiB
4Wrong answer0/21ms508 KiB
5Wrong answer0/31ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/34ms316 KiB
8Wrong answer0/34ms328 KiB
9Wrong answer0/24ms404 KiB
10Wrong answer0/24ms508 KiB
11Time limit exceeded0/3699ms764 KiB
12Time limit exceeded0/3680ms768 KiB
13Time limit exceeded0/3681ms808 KiB
14Time limit exceeded0/3685ms768 KiB
15Time limit exceeded0/3679ms768 KiB
16Time limit exceeded0/3699ms800 KiB
17Time limit exceeded0/3699ms768 KiB
18Time limit exceeded0/3699ms768 KiB
19Time limit exceeded0/3685ms768 KiB
20Time limit exceeded0/3699ms808 KiB