This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef ARTHUR_LOCAL
#include "stations.h"
#endif
#ifdef ARTHUR_LOCAL
#include <bits/stdc++.h>
#endif
using namespace std;
using ll = long long;
vector<int> adj[1001];
bool vis[1001];
int curv;
int labellist[1001];
void dfs(int v)
{
vis[v]=1;
labellist[v]=curv++;
for(auto u:adj[v])
{
if(!vis[u]) dfs(u);
}
}
vector<int> label(int n, int k, vector<int> U, vector<int> V)
{
for(int i=0; i<n; i++)
{
adj[i].clear();
vis[i]=0;
}
for(int i=0; i<n-1; i++)
{
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
for(int i=0; i<n-1; i++)
{
if(adj[i].size() == 1)
{
curv=0;
dfs(i);
break;
}
}
vector<int> ans;
for(int i=0; i<n; i++)
{
ans.push_back(labellist[i]);
}
return ans;
}
int find_next_station(int s, int t, vector<int> C)
{
if(C.size() == 1) return C[0];
if(s < t)
{
return C[1];
}
else
{
return C[0];
}
}
# | 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... |