제출 #831146

#제출 시각아이디문제언어결과실행 시간메모리
831146Baytoro기지국 (IOI20_stations)C++17
0 / 100
1742 ms2097152 KiB
#include "stations.h" //#include "stub.cpp" #include <bits/stdc++.h> using namespace std; #define pb push_back const int N=1005; vector<int> g[N]; int cnt; void dfs(int x, int p, int D, vector<int> &v){ if(D%2==0) v[x]=cnt++; for(auto it: g[x]){ if(it==p) continue; dfs(it,x,D+1,v); } if(D%2) v[x]=cnt++; } vector<int> label(int n, int k,vector<int> u, vector<int> v) { for(int i=0;i<n-1;i++){ g[u[i]].pb(v[i]); g[v[i]].pb(u[i]); } vector<int> ans(n,0); dfs(0,0,0,ans); return ans; } int find_next_station(int s, int t, vector<int> c) { assert(0); if(s>=c.back()){ if(t>s || t<c[0]) return c[0]; return c[lower_bound(c.begin(),c.end(),t+1)-c.begin()-1]; } else{ if(t<s || t>c.back()) return c.back(); return c[lower_bound(c.begin(),c.end(),t)-c.begin()]; } }
#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...