提出 #68746912


ソースコード 拡げる

N, Q = map(int, input().split())

A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

ans = 0
for i in range(1, N + 1):
    ans += min(A[i], B[i])

for _ in range(Q):
    c, X, V = input().split()
    X = int(X)
    V = int(V)

    if A[X] < B[X]:
        ans -= A[X]
    else:
        ans -= B[X]

    if c == "A":
        A[X] = V
    else:
        B[X] = V
    
    ans += min(A[X], B[X])

    print(ans)

提出情報

提出日時
問題 C - Sum of Min Query
ユーザ skuru
言語 Python (PyPy 3.10-v7.3.12)
得点 300
コード長 468 Byte
結果 AC
実行時間 488 ms
メモリ 123816 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 23
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 56 ms 76232 KiB
00_sample_01.txt AC 56 ms 76676 KiB
00_sample_02.txt AC 56 ms 76464 KiB
01_random_00.txt AC 56 ms 76308 KiB
01_random_01.txt AC 464 ms 121524 KiB
01_random_02.txt AC 457 ms 123816 KiB
01_random_03.txt AC 279 ms 113172 KiB
01_random_04.txt AC 478 ms 119052 KiB
01_random_05.txt AC 242 ms 118672 KiB
01_random_06.txt AC 447 ms 113224 KiB
01_random_07.txt AC 168 ms 113668 KiB
01_random_08.txt AC 488 ms 120552 KiB
01_random_09.txt AC 456 ms 120556 KiB
01_random_10.txt AC 487 ms 120588 KiB
01_random_11.txt AC 426 ms 120004 KiB
01_random_12.txt AC 488 ms 120492 KiB
01_random_13.txt AC 483 ms 120180 KiB
01_random_14.txt AC 478 ms 120596 KiB
01_random_15.txt AC 481 ms 120288 KiB
01_random_16.txt AC 479 ms 120372 KiB
01_random_17.txt AC 477 ms 120444 KiB
01_random_18.txt AC 472 ms 118992 KiB
01_random_19.txt AC 481 ms 120332 KiB