제출 #772584

#제출 시각아이디문제언어결과실행 시간메모리
772584khshg기지국 (IOI20_stations)C++14
0 / 100
692 ms464 KiB
#include"stations.h" #include<bits/stdc++.h> using namespace std; vector<vector<int>> adj; vector<int> label(int N, int K, vector<int> u, vector<int> v) { adj.resize(N); for(auto& I : adj) I.clear(); for(int i = 0; i < (int)u.size(); ++i) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } vector<int> flat(N); int root = -1; for(int i = 0; i < N; ++i) { if((int)adj[i].size() == 1) { root = i; break; } } vector<int> labels(N); int cur = root, prev = -1; for(int i = 0; ; ++i) { flat[i] = cur; labels[cur] = i; if(i == N - 1) break; bool f = (adj[cur][0] == prev); prev = cur; cur = adj[i][f]; } return labels; } int find_next_station(int s, int t, vector<int> c) { if(s > t) { return s - 1; } return s + 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...