結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー 👑 KazunKazun
提出日時 2023-02-16 03:32:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 91,644 KB
最終ジャッジ日時 2023-09-29 09:27:25
合計ジャッジ時間 8,742 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,308 KB
testcase_01 AC 70 ms
71,372 KB
testcase_02 AC 71 ms
71,604 KB
testcase_03 AC 70 ms
71,404 KB
testcase_04 AC 75 ms
71,308 KB
testcase_05 AC 76 ms
71,588 KB
testcase_06 AC 76 ms
71,496 KB
testcase_07 AC 130 ms
87,616 KB
testcase_08 AC 96 ms
82,108 KB
testcase_09 AC 109 ms
87,772 KB
testcase_10 AC 98 ms
79,208 KB
testcase_11 AC 108 ms
83,820 KB
testcase_12 AC 119 ms
90,940 KB
testcase_13 AC 110 ms
88,988 KB
testcase_14 AC 104 ms
84,928 KB
testcase_15 AC 122 ms
84,256 KB
testcase_16 AC 118 ms
82,668 KB
testcase_17 AC 136 ms
91,368 KB
testcase_18 AC 138 ms
91,592 KB
testcase_19 AC 142 ms
91,348 KB
testcase_20 AC 141 ms
91,352 KB
testcase_21 AC 139 ms
91,368 KB
testcase_22 AC 136 ms
91,536 KB
testcase_23 AC 140 ms
91,644 KB
testcase_24 AC 137 ms
91,468 KB
testcase_25 AC 138 ms
91,400 KB
testcase_26 AC 137 ms
91,440 KB
testcase_27 AC 125 ms
91,016 KB
testcase_28 AC 139 ms
90,952 KB
testcase_29 AC 115 ms
83,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N,M=map(int,input().split())
    A=[0]+list(map(int,input().split()))

    power=sum(a*a for a in A)

    Q=int(input())
    Ans=[0]*Q
    for q in range(Q):
        C,K,D=map(int,input().split())
        power+=(A[D]+K)*(A[D]+K)+(A[C]-K)*(A[C]-K)-(A[D]*A[D]+A[C]*A[C])
        A[D]+=K; A[C]-=K
        Ans[q]=power
    return Ans

#==================================================
import sys
input=sys.stdin.readline
write=sys.stdout.write

write("\n".join(map(str,solve())))
0