結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー miya145592miya145592
提出日時 2023-05-19 22:52:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 90,752 KB
最終ジャッジ日時 2024-05-10 06:19:37
合計ジャッジ時間 7,268 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 41 ms
51,584 KB
testcase_02 AC 59 ms
62,720 KB
testcase_03 AC 43 ms
53,120 KB
testcase_04 AC 72 ms
66,432 KB
testcase_05 AC 69 ms
67,072 KB
testcase_06 AC 67 ms
67,584 KB
testcase_07 AC 165 ms
86,144 KB
testcase_08 AC 103 ms
80,896 KB
testcase_09 AC 133 ms
86,016 KB
testcase_10 AC 130 ms
81,024 KB
testcase_11 AC 138 ms
82,920 KB
testcase_12 AC 160 ms
90,112 KB
testcase_13 AC 141 ms
87,936 KB
testcase_14 AC 129 ms
83,456 KB
testcase_15 AC 184 ms
86,332 KB
testcase_16 AC 189 ms
86,784 KB
testcase_17 AC 210 ms
90,624 KB
testcase_18 AC 212 ms
90,368 KB
testcase_19 AC 213 ms
90,496 KB
testcase_20 AC 213 ms
90,624 KB
testcase_21 AC 206 ms
90,240 KB
testcase_22 AC 203 ms
90,496 KB
testcase_23 AC 209 ms
90,752 KB
testcase_24 AC 213 ms
90,752 KB
testcase_25 AC 208 ms
90,496 KB
testcase_26 AC 205 ms
90,368 KB
testcase_27 AC 198 ms
89,088 KB
testcase_28 AC 210 ms
89,344 KB
testcase_29 AC 193 ms
86,656 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