QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#378139#7926. Color Inversion on a Huge Chessboardkevinyang#RE 15ms12272kbPython3612b2024-04-06 06:55:202024-04-06 06:55:21

Judging History

你现在查看的是最新测评结果

  • [2024-04-06 06:55:21]
  • 评测
  • 测评结果:RE
  • 用时:15ms
  • 内存:12272kb
  • [2024-04-06 06:55:20]
  • 提交

answer

n, q = [int(i) for i in input().split()]
a = [i%2 for i in range(n)]
b = [i%2 for i in range(n)]

acnt = n
bcnt = n

def toggle(arr, pos):
    arr[pos] = 1-arr[pos]
    if pos == 0:
        return -1 if arr[0] == arr[1] else 1

    if pos == n-1:
        return -1 if arr[n-1] == arr[n-2] else 1
    
    return -2 if arr[pos-1] == arr[pos] == arr[pos+1] else 2
    

for _ in range(q):
    type, pos = input().split()
    pos = int(pos)
    pos -= 1
    if type == 'COLUMN':
        acnt += toggle(a, pos)
    if type == 'ROW':
        bcnt += toggle(b, pos)

    print(acnt*bcnt)


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 9588kb

input:

3 3
ROW 2
COLUMN 3
ROW 2

output:

3
2
6

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 15ms
memory: 12272kb

input:

200000 2
ROW 1
ROW 1

output:

39999800000
40000000000

result:

ok 2 lines

Test #3:

score: -100
Dangerous Syscalls

input:

1 1
COLUMN 1

output:


result: