結果

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

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
now=0
for a in A:
  now+=a**2 
  
Q=int(input())
for _ in range(Q):
  c,k,d=map(int, input().split())
  c-=1;d-=1
  now-=A[c]**2+A[d]**2
  A[c]-=k;A[d]+=k
  now+=A[c]**2+A[d]**2
  print(now)
0