結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー yabityabit
提出日時 2023-06-24 09:20:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 375 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 87,312 KB
実行使用メモリ 90,960 KB
最終ジャッジ日時 2023-09-14 04:49:47
合計ジャッジ時間 12,658 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,372 KB
testcase_01 AC 57 ms
71,340 KB
testcase_02 AC 69 ms
75,288 KB
testcase_03 AC 60 ms
71,260 KB
testcase_04 AC 77 ms
76,168 KB
testcase_05 AC 77 ms
76,256 KB
testcase_06 AC 78 ms
76,456 KB
testcase_07 AC 220 ms
86,864 KB
testcase_08 AC 115 ms
82,540 KB
testcase_09 AC 172 ms
87,312 KB
testcase_10 AC 173 ms
78,604 KB
testcase_11 AC 184 ms
83,812 KB
testcase_12 AC 209 ms
90,512 KB
testcase_13 AC 167 ms
88,444 KB
testcase_14 AC 159 ms
84,680 KB
testcase_15 AC 265 ms
83,740 KB
testcase_16 AC 283 ms
79,268 KB
testcase_17 AC 301 ms
90,960 KB
testcase_18 AC 302 ms
90,700 KB
testcase_19 AC 313 ms
90,848 KB
testcase_20 AC 311 ms
90,552 KB
testcase_21 AC 375 ms
90,688 KB
testcase_22 AC 310 ms
90,920 KB
testcase_23 AC 316 ms
90,868 KB
testcase_24 AC 314 ms
90,656 KB
testcase_25 AC 357 ms
90,936 KB
testcase_26 AC 314 ms
90,932 KB
testcase_27 AC 295 ms
89,732 KB
testcase_28 AC 312 ms
90,160 KB
testcase_29 AC 329 ms
78,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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