Submission #81767

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
817672018-10-26 13:22:05chellyRace (IOI11_race)C++11
100 / 100
1909 ms107748 KiB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
const int MAXN = 200005, INF = 0x3f3f3f3f;
int N, K, H[MAXN][2], L[MAXN];
int sz[MAXN];
map<int, int> best;
bool done[MAXN];
vector<pii> adj[MAXN];
queue<pii> ar;
int ans = INF, target;
void dfs (int u, int p){
sz[u]=1;
for (pii e: adj[u]){
if (e.first==p||done[e.first]) continue;
dfs(e.first, u);
sz[u]+=sz[e.first];
}
}
int centroid (int u, int p, int S){
for (pii e: adj[u]){
if (sz[e.first]*2>S&&e.first!=p&&!done[e.first]) return centroid(e.first, u, S);
}
return u;
}
void path (int u, int p, int length, int cnt){
if (length==target) ans = min(ans, cnt);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...