제출 #828060

#제출 시각아이디문제언어결과실행 시간메모리
828060minhcool기지국 (IOI20_stations)C++17
5 / 100
708 ms28188 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; #include <vector> #define pb push_back const int N = 5e5 + 5; int n; vector<int> Adj[N]; int l[N], r[N]; vector<int> vis; void dfs(int u, int p){ l[u] = vis.size(); vis.pb(u); for(auto v : Adj[u]){ if(v == p) continue; dfs(v, u); } r[u] = vis.size(); } //vector<int> vis; int tol[1005][1005]; void prep(){ int cnt = 0; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ tol[i][j] = cnt; cnt++; } } } vector<int> label(int n_, int k, vector<int> u, vector<int> v) { prep(); n = n_; vis.clear(); for(int i = 0; i < n; i++) Adj[i].clear(); for(int i = 0; i < (n - 1); i++){ Adj[u[i]].pb(v[i]); Adj[v[i]].pb(u[i]); } for(int i = 0; i < n; i++){ if(Adj[i].size() == 1){ dfs(i, i); break; } } vector<int> labels(n); for(int i = 0; i < n; i++){ labels[vis[i]] = i; } return labels; /* std::vector<int> labels(n); for (int i = 0; i < n; i++) { labels[i] = i; } return labels;*/ } int find_next_station(int s, int t, std::vector<int> c) { if(s < t) return s + 1; else return s - 1; //return c[0]; }
#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...