제출 #615265

#제출 시각아이디문제언어결과실행 시간메모리
615265alirezasamimi100기지국 (IOI20_stations)C++17
0 / 100
3006 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define pb push_back const int N = 1e3 + 10; int t=-1; vector<int> ans,adj[N]; void dfs(int v, int p, int c){ if(!c) ans[v]=++t; for(int u : adj[v]) if(u!=p) dfs(u,v,1-c); if(c) ans[v]=++t; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { ans.resize(n); for(int i=0; i<(int)v.size(); i++){ adj[v[i]].pb(u[i]); adj[u[i]].pb(v[i]); } dfs(0,-1,0); return ans; } int find_next_station(int s, int t, vector<int> c) { int k; if(s<c[0]){ k=c.back(); if(s) c.pop_back(); if(t<s || t>c.back()) return k; return *lower_bound(c.begin(),c.end(),t); }else{ k=c[0]; c.erase(c.begin()); if(t<c[0] || t>s) return k; return *(upper_bound(c.begin(),c.end(),t)-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...