# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
614523 | John3_141592 | Stations (IOI20_stations) | C++14 | 2 ms | 692 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 "stations.h"
#include <bits/stdc++.h>
using namespace std;
int arr[1003];
vector <int> grafo[1003];
bool vis[1003];
void dfs(int node,int c){
vis[node]=true,arr[node]=c;
for(auto i:grafo[node]){
if(!vis[i]) dfs(i,c+1);
}
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for(int i=0;i<n;i++) grafo[u[i]].push_back(v[i]),grafo[v[i]].push_back(u[i]);
int node;
for(int i=1;i<=n;i++){
if(grafo[i].size()==1){
node=i;
break;
}
}
dfs(node,0);
vector <int> solve;
for(int i=0;i<n;i++) solve.push_back(arr[i]);
return solve;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(c.size()==1) return c[0];
if(s<t) return c[1];
return c[0];
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |