結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー ああいいああいい
提出日時 2023-05-22 22:35:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 771 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 91,076 KB
最終ジャッジ日時 2023-08-24 03:34:01
合計ジャッジ時間 13,133 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,312 KB
testcase_01 AC 70 ms
71,392 KB
testcase_02 AC 91 ms
75,312 KB
testcase_03 AC 71 ms
71,428 KB
testcase_04 AC 93 ms
76,184 KB
testcase_05 AC 95 ms
76,436 KB
testcase_06 AC 96 ms
76,412 KB
testcase_07 AC 271 ms
87,156 KB
testcase_08 AC 140 ms
82,748 KB
testcase_09 AC 200 ms
87,160 KB
testcase_10 AC 207 ms
78,468 KB
testcase_11 AC 217 ms
83,908 KB
testcase_12 AC 250 ms
90,580 KB
testcase_13 AC 198 ms
88,452 KB
testcase_14 AC 189 ms
84,296 KB
testcase_15 AC 323 ms
83,880 KB
testcase_16 AC 330 ms
79,616 KB
testcase_17 AC 366 ms
90,748 KB
testcase_18 AC 364 ms
90,956 KB
testcase_19 AC 369 ms
90,928 KB
testcase_20 AC 376 ms
90,604 KB
testcase_21 AC 372 ms
90,896 KB
testcase_22 AC 372 ms
91,076 KB
testcase_23 AC 373 ms
90,628 KB
testcase_24 AC 366 ms
90,992 KB
testcase_25 AC 361 ms
90,964 KB
testcase_26 AC 364 ms
91,052 KB
testcase_27 AC 340 ms
89,792 KB
testcase_28 AC 363 ms
89,656 KB
testcase_29 AC 335 ms
78,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))

ans = 0
for a in A:
    ans += a * a
q = int(input())
for _ in range(q):
    c,k,d = map(int,input().split())


    c -= 1
    d -= 1
    ans -= A[c] * A[c]
    A[c] -= k
    ans += A[c] * A[c]
    ans -= A[d] * A[d]
    A[d] += k
    ans += A[d] * A[d]
    print(ans)
    
0