제출 #726528

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7265282023-04-19 03:46:23hoainiem경주 (Race) (IOI11_race)C++14
100 / 100
542 ms32280 KiB
#include "race.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define nmax 200008
#define kmax 1000008
const int inf = 1e9;
using namespace std;
typedef pair<int, int> pii;
int n, k, lim, ans = inf, sz[nmax], f[kmax];
bool kt[nmax];
vector<pii>l[nmax];
int dfs(int x, int pre){
sz[x] = 1;
for (pii it : l[x]){
if (it.fi == pre || kt[it.fi])
continue;
sz[x] += dfs(it.fi, x);
}
return sz[x];
}
int centroid(int rt, int x, int pre){
for (pii it : l[x]){
if (it.fi == pre || kt[it.fi])
continue;
if (sz[it.fi] * 2 > sz[rt])
return centroid(rt, it.fi, x);
}
return x;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...