# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
157149 | GioChkhaidze | Race (IOI11_race) | C++14 | 959 ms | 38776 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 F first
#define S second
using namespace std;
const int Nm=200005;
const int Mm=1000006;
int n,k,ANS=1e9,Lvl[Nm],F[Mm],F1[Mm];
pair < int , int > val;
vector < pair < int , int > > v[Nm];
int Dfs (int x,int size,int &Center,int p) {
int tot=1;
for (int i=0; i<v[x].size(); i++)
if (Lvl[v[x][i].F]==-1 && v[x][i].F!=p) tot+=Dfs(v[x][i].F,size,Center,x);
if (Center==-1 && (2*tot>=size || p==-1)) Center=x;
return tot;
}
void Df(int x,int p,int type) {
if (val.F==k) ANS=min(ANS,val.S);
if (val.F>=k) return ;
if (type==1) F[val.F]=min(F[val.F],val.S),ANS=min(ANS,F[val.F]+F1[k-val.F]);
else
if (type==2) F1[val.F]=min(F1[val.F],F[val.F]),F[val.F]=1e9;
else F1[val.F]=1e9;
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... |