結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー miya145592miya145592
提出日時 2023-05-19 22:52:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 91,860 KB
最終ジャッジ日時 2023-08-23 00:55:34
合計ジャッジ時間 8,931 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,172 KB
testcase_01 AC 71 ms
71,248 KB
testcase_02 AC 104 ms
75,736 KB
testcase_03 AC 74 ms
71,196 KB
testcase_04 AC 94 ms
76,552 KB
testcase_05 AC 94 ms
76,528 KB
testcase_06 AC 95 ms
76,332 KB
testcase_07 AC 217 ms
88,056 KB
testcase_08 AC 126 ms
83,104 KB
testcase_09 AC 156 ms
88,064 KB
testcase_10 AC 152 ms
81,616 KB
testcase_11 AC 160 ms
85,124 KB
testcase_12 AC 178 ms
90,920 KB
testcase_13 AC 158 ms
89,460 KB
testcase_14 AC 151 ms
85,200 KB
testcase_15 AC 202 ms
88,344 KB
testcase_16 AC 205 ms
88,280 KB
testcase_17 AC 224 ms
91,656 KB
testcase_18 AC 227 ms
91,652 KB
testcase_19 AC 223 ms
91,588 KB
testcase_20 AC 227 ms
91,732 KB
testcase_21 AC 223 ms
91,756 KB
testcase_22 AC 227 ms
91,840 KB
testcase_23 AC 225 ms
91,860 KB
testcase_24 AC 224 ms
91,696 KB
testcase_25 AC 233 ms
91,384 KB
testcase_26 AC 227 ms
91,536 KB
testcase_27 AC 215 ms
91,208 KB
testcase_28 AC 222 ms
91,112 KB
testcase_29 AC 208 ms
88,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = list(map(int, input().split()))
Q = int(input())
CKD = [list(map(int, input().split())) for _ in range(Q)]
S = 0
for a in A:
    S += a**2
for c, k, d in CKD:
    c-=1
    d-=1
    S -= A[c]**2
    S -= A[d]**2
    A[c]-=k
    A[d]+=k
    S += A[c]**2
    S += A[d]**2
    print(S)
0