7292021-12-21 14:42:39kismartongSzínezéspython3Wrong answer 0/50691ms15472 KiB
from sys import stdin, stdout

def minVal(n, g):
    pir = g.count(0)
    kek = g.count(1)
    if pir > kek:
        return n-pir
    else:
        return n-kek

def main():
    n, q = map(int, stdin.readline().split())
    gi = stdin.readline()
    g = [0]*n
    for i in range(n):
        g[i] = int(gi[i])
    meg = []
    meg.append(minVal(n, g))
    for i in range(q):
        c = int(stdin.readline())
        if g[c-1] == 0:
            g[c-1] = 1
        else:
            g[c-1] = 0
        meg.append(minVal(n, g))
    for i in range(q+1):
        stdout.writelines(str(meg[i]) + "\n")

main()
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/043ms15008 KiB
2Wrong answer0/0338ms15472 KiB
3Wrong answer0/232ms15196 KiB
4Wrong answer0/228ms15160 KiB
5Wrong answer0/329ms15164 KiB
6Wrong answer0/329ms15168 KiB
7Wrong answer0/357ms15216 KiB
8Wrong answer0/352ms15220 KiB
9Wrong answer0/252ms15292 KiB
10Wrong answer0/252ms15244 KiB
11Time limit exceeded0/3677ms8616 KiB
12Time limit exceeded0/3676ms8984 KiB
13Time limit exceeded0/3616ms9420 KiB
14Time limit exceeded0/3691ms9796 KiB
15Time limit exceeded0/3640ms10036 KiB
16Time limit exceeded0/3675ms10528 KiB
17Time limit exceeded0/3640ms10832 KiB
18Time limit exceeded0/3640ms11144 KiB
19Time limit exceeded0/3629ms11576 KiB
20Time limit exceeded0/3648ms11448 KiB