# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
16516 | khsoo01 | Race (IOI11_race) | C++98 | 1247 ms | 48368 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "race.h"
#define INF 987654321
using namespace std;
vector<int>cg[200005],cv[200005];
stack<int>used;
int ch[200005],p[1000005],n,cn,k,ans=INF;
bool col[200005];
void count_num(int idx,int prev) {
int i; cn++;
for(i=0;i<cg[idx].size();i++) {
if(!col[cg[idx][i]] && cg[idx][i]!=prev) {
count_num(cg[idx][i],idx);
}
}
}
pair<int,int> find_cen(int idx,int prev) {
pair<int,int> ret(INF,-1),tmp;
int i,cc=1,mc=0;
for(i=0;i<cg[idx].size();i++) {
if(col[cg[idx][i]] || cg[idx][i]==prev) continue;
tmp=find_cen(cg[idx][i],idx);
if(tmp.first<ret.first) ret=tmp;
mc=max(mc,ch[cg[idx][i]]);
cc+=ch[cg[idx][i]];
}
mc=max(mc,cn-cc);
if(mc<ret.first) ret={mc,idx};
Compilation message (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |