# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
856105 | wii | 경주 (Race) (IOI11_race) | C++17 | 353 ms | 65984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
const int Lim = 1e6 + 5;
const int maxn = 1e6 + 5;
const int Inf = 1e9 + 7;
typedef pair<int, int> pii;
template<class T> bool minimize(T &res, const T &x) { if (x < res) { res = x; return true; } return false; }
int n, k;
vector<pii> adj[maxn];
int ans[Lim];
int sz[maxn], f[maxn];
int dfs_sz(int u, int p) {
sz[u] = 1;
for (auto [v, w]: adj[u]) if (v != p && !f[v]) {
sz[u] += dfs_sz(v, u);
}
return sz[u];
}
int find_centroid(int u, int p, int n) {
for (auto [v, w]: adj[u]) if (v != p && !f[v])
if (sz[v] * 2 > n) return find_centroid(v, u, n);
return u;
}
# | 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... |