結果
問題 | No.3025 Chocol∀te |
ユーザー |
👑 ![]() |
提出日時 | 2025-02-13 05:51:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,121 bytes |
コンパイル時間 | 2,255 ms |
コンパイル使用メモリ | 202,088 KB |
実行使用メモリ | 54,784 KB |
最終ジャッジ日時 | 2025-02-14 14:58:24 |
合計ジャッジ時間 | 54,535 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 64 TLE * 9 |
ソースコード
#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);for (int i = 0; i < N; i++){cin >> 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);} else {G[a].insert(b);G[b].insert(a);}}if (t == 2){int i, a;cin >> i >> a;i--;A[i] = a;}if (t == 3){int c;cin >> c;c--;ll ans = 0;for (auto x : G[c]) ans += A[x];cout << ans << "\n";}}}