結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-19 22:19:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 358 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,984 KB
最終ジャッジ日時 2024-05-10 05:45:04
合計ジャッジ時間 10,566 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 40 ms
51,840 KB
testcase_02 AC 59 ms
61,696 KB
testcase_03 AC 43 ms
53,248 KB
testcase_04 AC 70 ms
65,920 KB
testcase_05 AC 72 ms
66,304 KB
testcase_06 AC 71 ms
66,560 KB
testcase_07 AC 262 ms
86,144 KB
testcase_08 AC 122 ms
81,280 KB
testcase_09 AC 182 ms
86,272 KB
testcase_10 AC 190 ms
77,184 KB
testcase_11 AC 202 ms
82,812 KB
testcase_12 AC 235 ms
89,088 KB
testcase_13 AC 187 ms
87,808 KB
testcase_14 AC 173 ms
83,584 KB
testcase_15 AC 311 ms
82,816 KB
testcase_16 AC 307 ms
78,336 KB
testcase_17 AC 352 ms
89,472 KB
testcase_18 AC 351 ms
89,472 KB
testcase_19 AC 347 ms
89,600 KB
testcase_20 AC 358 ms
89,984 KB
testcase_21 AC 347 ms
89,344 KB
testcase_22 AC 352 ms
89,600 KB
testcase_23 AC 347 ms
89,472 KB
testcase_24 AC 354 ms
89,728 KB
testcase_25 AC 349 ms
89,344 KB
testcase_26 AC 345 ms
89,344 KB
testcase_27 AC 335 ms
88,576 KB
testcase_28 AC 344 ms
88,320 KB
testcase_29 AC 315 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = list(map(int,input().split()))

score = 0
for a in A:
    score += a**2

q = int(input())
for _ in range(q):
    c,k,d = map(int,input().split())
    c,d = c-1,d-1

    score -= A[c]**2 + A[d]**2

    A[c] -= k
    A[d] += k

    score += A[c]**2 + A[d]**2

    print(score)
0