結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー n_nan_na
提出日時 2023-05-19 22:59:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 1,252 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 90,736 KB
最終ジャッジ日時 2023-08-23 00:59:54
合計ジャッジ時間 12,662 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,300 KB
testcase_01 AC 71 ms
71,236 KB
testcase_02 AC 90 ms
75,464 KB
testcase_03 AC 76 ms
71,412 KB
testcase_04 AC 92 ms
76,188 KB
testcase_05 AC 92 ms
76,120 KB
testcase_06 AC 93 ms
76,128 KB
testcase_07 AC 293 ms
86,928 KB
testcase_08 AC 137 ms
82,404 KB
testcase_09 AC 196 ms
87,072 KB
testcase_10 AC 204 ms
78,540 KB
testcase_11 AC 216 ms
83,348 KB
testcase_12 AC 251 ms
90,372 KB
testcase_13 AC 202 ms
88,556 KB
testcase_14 AC 188 ms
84,068 KB
testcase_15 AC 313 ms
83,400 KB
testcase_16 AC 325 ms
78,912 KB
testcase_17 AC 357 ms
90,712 KB
testcase_18 AC 353 ms
90,576 KB
testcase_19 AC 351 ms
90,428 KB
testcase_20 AC 357 ms
90,548 KB
testcase_21 AC 359 ms
90,736 KB
testcase_22 AC 359 ms
90,732 KB
testcase_23 AC 357 ms
90,432 KB
testcase_24 AC 359 ms
90,372 KB
testcase_25 AC 358 ms
90,576 KB
testcase_26 AC 356 ms
90,248 KB
testcase_27 AC 336 ms
89,532 KB
testcase_28 AC 369 ms
89,772 KB
testcase_29 AC 341 ms
78,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

S = 0
for i in range(M):
    S += A[i]*A[i]

Q = int(input())
for _ in range(Q):
    C,K,D = map(int,input().split())
    S -= A[C-1]*A[C-1]
    S -= A[D-1]*A[D-1]
    A[C-1] -= K
    A[D-1] += K
    S += A[C-1]*A[C-1]
    S += A[D-1]*A[D-1]
    print(S)
    
    
0