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 "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define X first
#define Y second
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define SZ(a) ((int)a.size())
const int C=1000;
vector<int> G[1005],idx;
int dft;
void dfs(int u,int f)
{
idx[u]=++dft;
for(int i:G[u])
if(i!=f)
dfs(i,u);
}
vector<int> label(int n, int k, vector<int> u, vector<int> v)
{
idx.resize(n),dft=-1;
for(int i=0;i<n;++i)
G[i].clear();
for(int i=0;i+1<n;++i)
G[u[i]].pb(v[i]),G[v[i]].pb(u[i]);
for(int i=0;i<n;++i)
if(SZ(G[i])==1)
{
dfs(i,i);
break;
}
return idx;
}
int find_next_station(int s, int t, vector<int> c)
{
if(s>t)
return *min_element(ALL(c));
else
return *max_element(ALL(c));
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |