Submission #926239

#TimeUsernameProblemLanguageResultExecution timeMemory
926239velislavgarkovStations (IOI20_stations)C++14
0 / 100
551 ms940 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++) in[i]=i; br=0; for (int i=0;i<n-1;i++) { ver[u[i]].push_back(v[i]); ver[v[i]].push_back(u[i]); } return in; 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...