| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 406724 | tengiz05 | 다리 (APIO19_bridges) | C++17 | 3092 ms | 7916 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m, q;
std::cin >> n >> m;
std::vector<std::tuple<int, int, int>> edges;
for (int i = 0; i < m; i++) {
int u, v, w;
std::cin >> u >> v >> w;
u--;
v--;
edges.emplace_back(u, v, w);
}
std::cin >> q;
while (q--) {
int type;
std::cin >> type;
if (type == 1) {
int b, r;
std::cin >> b >> r;
b--;
std::get<2>(edges[b]) = r;
} else {
std::vector<std::vector<std::pair<int, int>>> e(n);
for (auto [u, v, w] : edges) {
e[u].emplace_back(v, w);
e[v].emplace_back(u, w);
}
int s, W;
std::cin >> s >> W;
s--;
int ans = 0;
std::vector<bool> vis(n);
std::function<void(int)> dfs = [&](int u){
ans++;
vis[u] = true;
for (auto [v, w] : e[u]) {
if (!vis[v] && w >= W) {
dfs(v);
}
}
};
dfs(s);
std::cout << ans << '\n';
}
}
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
