結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-19 22:19:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 89,776 KB
最終ジャッジ日時 2024-12-18 03:02:07
合計ジャッジ時間 8,969 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

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