# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
997633 | fuad27 | Hard route (IZhO17_road) | C++17 | 324 ms | 82144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 500100;
vector<int> g[N];
int n;
pair<int,int> dp[N];
pair<ll,ll> ans={0, 1};
void dfs1(int at, int p) {
dp[at] = {1, 1};
for(int to:g[at]) {
if(to==p)continue;
dfs1(to, at);
if(dp[to].first+1 > dp[at].first) {
dp[at]=dp[to];
dp[at].first++;
}
else if(dp[to].first+1 == dp[at].first) {
dp[at].second+=dp[to].second;
}
}
}
void dfs2(int at, int p) {
sort(g[at].begin(), g[at].end(), [&](int u, int v) {
return dp[u].first > dp[v].first;
});
if(g[at].size()>=3) {
ll a = dp[g[at][0]].first, b = dp[g[at][1]].first, c = dp[g[at][2]].first;
ll res = a*(b+c);
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |