結果
| 問題 |
No.2306 [Cherry 5th Tune C] ウソツキタマシイ
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2023-05-19 21:49:27 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 466 ms / 2,000 ms |
| コード長 | 343 bytes |
| コンパイル時間 | 276 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 20,484 KB |
| 最終ジャッジ日時 | 2024-12-18 02:33:11 |
| 合計ジャッジ時間 | 10,668 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=list(map(int,input().split()))
Q=int(input())
ANS=0
for a in A:
ANS+=a*a
for tests in range(Q):
c,k,d=map(int,input().split())
c-=1
ANS-=A[c]*A[c]
A[c]-=k
ANS+=A[c]*A[c]
d-=1
ANS-=A[d]*A[d]
A[d]+=k
ANS+=A[d]*A[d]
print(ANS)
titia