# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
309931 | tjdgus4384 | Stations (IOI20_stations) | C++14 | 1029 ms | 1040 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;
vector<int> path[1001];
bool visited[1001];
int tsize[1001], lb[1001];
int dfs(int x){
int s = 1;
for(int i = 0;i < path[x].size();i++){
if(visited[path[x][i]]) continue;
visited[path[x][i]] = true;
s += dfs(path[x][i]);
}
return tsize[x] = s;
}
void dfs2(int x, int s, int e, int d){
if(d%2 == 0) {lb[x] = s; s++;}
else lb[x] = e;
for(int i = 0;i < path[x].size();i++){
if(visited[path[x][i]]) continue;
visited[path[x][i]] = true;
dfs2(path[x][i], s, s+tsize[path[x][i]]-1, d+1);
s+=tsize[path[x][i]];
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v){
for(int i = 0;i < n;i++) path[i].clear();
for(int i = 0;i < n-1;i++){
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... |