結果
問題 |
No.2306 [Cherry 5th Tune C] ウソツキタマシイ
|
ユーザー |
|
提出日時 | 2023-09-22 17:16:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 239 ms / 2,000 ms |
コード長 | 415 bytes |
コンパイル時間 | 1,560 ms |
コンパイル使用メモリ | 195,676 KB |
最終ジャッジ日時 | 2025-02-17 00:06:40 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; int main() { ll N,M,Q,C,K,D,S=0; cin>>N>>M; vector<ll> A(M); for(ll i=0;i<M;i++){ cin>>A[i]; S+=A[i]*A[i]; } cin>>Q; for(ll q=0;q<Q;q++){ cin>>C>>K>>D; C--;D--; S-=A[C]*A[C]+A[D]*A[D]; A[C]-=K; A[D]+=K; S+=A[C]*A[C]+A[D]*A[D]; cout<<S<<endl; } }