제출 #926243

#제출 시각아이디문제언어결과실행 시간메모리
926243velislavgarkov기지국 (IOI20_stations)C++14
0 / 100
590 ms904 KiB
#include "stations.h" #include <iostream> #include <algorithm> #include <vector> using namespace std; const int MAXN=1e3+10; vector <int> ver[MAXN]; vector <int> in; int br; void dfs(int x, int par) { in[x]=br; br++; for (auto i:ver[x]) { if (i==par) continue; dfs(i,x); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { in.resize(n); for (int i=0;i<n;i++) { if (!ver[i].empty()) ver[i].clear(); } br=0; for (int i=0;i<n-1;i++) { ver[u[i]].push_back(v[i]); ver[v[i]].push_back(u[i]); } dfs(0,-1); return in; } int find_next_station(int s, int t, vector<int> c) { return c[0]; if (s>t) return c[0]; int l, r, mid; l=0; r=c.size()-1; while (l<=r) { mid=(l+r)/2; if (c[mid]<=t) l=mid+1; else r=mid-1; } return c[r]; }
#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...