# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396254 | faresbasbs | Stations (IOI20_stations) | C++14 | 1124 ms | 844 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 "stations.h"
using namespace std;
void dfs(int curr , int par , int hi , vector<vector<int>> &graph , int &cnt , vector<int> &ret){
if(hi%2 == 0){
ret[curr] = cnt;
cnt += 1;
}
for(auto i : graph[curr]){
if(i == par){
continue;
}
dfs(i,curr,hi+1,graph,cnt,ret);
}
if(hi%2 == 1){
ret[curr] = cnt;
cnt += 1;
}
}
vector<int> label(int n , int k , vector<int> u , vector<int> v){
vector<vector<int>> graph(1001);
int cnt = 0;
for(int i = 0 ; i < u.size() ; i += 1){
graph[u[i]].push_back(v[i]);
graph[v[i]].push_back(u[i]);
}
vector<int> labels(n);
dfs(0,0,0,graph,cnt,labels);
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... |