QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#378138#7926. Color Inversion on a Huge Chessboardkevinyang#WA 7ms9952kbPython3631b2024-04-06 06:54:592024-04-06 06:55:00

Judging History

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

  • [2024-04-06 06:55:00]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:9952kb
  • [2024-04-06 06:54:59]
  • 提交

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
print(acnt, bcnt)

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: 0
Wrong Answer
time: 7ms
memory: 9952kb

input:

3 3
ROW 2
COLUMN 3
ROW 2

output:

3 3
3
2
6

result:

wrong answer 1st lines differ - expected: '3', found: '3 3'