結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー KudeKude
提出日時 2023-05-19 21:31:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 341 ms / 2,000 ms
コード長 305 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 90,464 KB
最終ジャッジ日時 2023-08-22 23:35:22
合計ジャッジ時間 10,922 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,116 KB
testcase_01 AC 68 ms
70,956 KB
testcase_02 AC 84 ms
74,980 KB
testcase_03 AC 74 ms
71,328 KB
testcase_04 AC 96 ms
75,992 KB
testcase_05 AC 93 ms
76,104 KB
testcase_06 AC 91 ms
76,108 KB
testcase_07 AC 252 ms
86,928 KB
testcase_08 AC 137 ms
82,016 KB
testcase_09 AC 192 ms
86,832 KB
testcase_10 AC 196 ms
78,344 KB
testcase_11 AC 192 ms
83,324 KB
testcase_12 AC 258 ms
90,120 KB
testcase_13 AC 186 ms
88,344 KB
testcase_14 AC 178 ms
84,436 KB
testcase_15 AC 297 ms
83,396 KB
testcase_16 AC 293 ms
79,208 KB
testcase_17 AC 341 ms
90,172 KB
testcase_18 AC 322 ms
90,248 KB
testcase_19 AC 335 ms
90,408 KB
testcase_20 AC 333 ms
90,188 KB
testcase_21 AC 329 ms
90,312 KB
testcase_22 AC 325 ms
90,320 KB
testcase_23 AC 326 ms
90,464 KB
testcase_24 AC 330 ms
90,280 KB
testcase_25 AC 336 ms
90,028 KB
testcase_26 AC 326 ms
90,360 KB
testcase_27 AC 306 ms
89,492 KB
testcase_28 AC 326 ms
89,160 KB
testcase_29 AC 303 ms
78,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
h = list(map(int, input().split()))
now = sum(x * x for x in h)
for _ in range(int(input())):
    c, k, d = map(int, input().split())
    c -= 1
    d -= 1
    now -= h[c] * h[c] + h[d] * h[d]
    h[c] -= k
    h[d] += k
    now += h[c] * h[c] + h[d] * h[d]
    print(now)
0