| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364131 | kawhiet | Bridges (APIO19_bridges) | C++20 | 3095 ms | 5060 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<array<int, 3>> e;
for (int i = 0; i < m; i++) {
int u, v, w;
cin >> u >> v >> w;
u--; v--;
e.push_back({u, v, w});
}
int q;
cin >> q;
while (q--) {
int t;
cin >> t;
if (t == 1) {
int b, r;
cin >> b >> r;
b--;
e[b][2] = r;
} else {
int s, w;
cin >> s >> w;
s--;
vector<vector<int>> g(n);
for (auto [u, v, d] : e) {
if (d >= w) {
g[u].push_back(v);
g[v].push_back(u);
}
}
vector<bool> vis(n);
int res = 1;
vis[s] = true;
queue<int> q;
q.push(s);
while (!q.empty()) {
int u = q.front();
q.pop();
for (int v : g[u]) {
if (!vis[v]) {
res++;
vis[v] = true;
q.push(v);
}
}
}
cout << res << '\n';
}
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
