結果
問題 | No.2306 [Cherry 5th Tune C] ウソツキタマシイ |
ユーザー |
|
提出日時 | 2023-05-19 21:24:34 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 119 ms / 2,000 ms |
コード長 | 378 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 82,036 KB |
実行使用メモリ | 89,808 KB |
最終ジャッジ日時 | 2024-12-18 02:11:15 |
合計ジャッジ時間 | 4,895 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
import sys input = sys.stdin.readline n, m = map(int, input().split()) A = list(map(int, input().split())) ans = 0 for i in range(m): ans += pow(A[i], 2) q = int(input()) for _ in range(q): c, k, d = map(int, input().split()) c -= 1 d -= 1 ans -= pow(A[c], 2) + pow(A[d], 2) A[c] -= k A[d] += k ans += pow(A[c], 2) + pow(A[d], 2) print(ans)