結果
問題 | No.3025 Chocol∀te |
ユーザー |
👑 ![]() |
提出日時 | 2025-02-14 14:05:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,326 bytes |
コンパイル時間 | 2,154 ms |
コンパイル使用メモリ | 204,236 KB |
実行使用メモリ | 54,504 KB |
最終ジャッジ日時 | 2025-02-14 15:00:46 |
合計ジャッジ時間 | 71,953 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 60 TLE * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int N, M;cin >> N >> M;vector<unordered_set<int>> G(N);for (int i = 0; i < M; i++){int a, b;cin >> a >> b;a--, b--;G[a].insert(b);G[b].insert(a);}vector<ll> A(N);vector<ll> ans(N);for (int i = 0; i < N; i++){cin >> A[i];}for (int i = 0; i < N; i++) for (auto x : G[i]) ans[x] += A[i];int Q;cin >> Q;while (Q--){int t;cin >> t;if (t == 1){int a, b;cin >> a >> b;a--, b--;if (G[a].count(b)){G[a].erase(b);G[b].erase(a);ans[a] -= A[b];ans[b] -= A[a];} else {G[a].insert(b);G[b].insert(a);ans[a] += A[b];ans[b] += A[a];}}if (t == 2){int i, a;cin >> i >> a;i--;for (auto x : G[i]) ans[x] += a - A[i];A[i] = a;}if (t == 3){int c;cin >> c;c--;cout << ans[c] << "\n";}}}