제출 #824401

#제출 시각아이디문제언어결과실행 시간메모리
824401ymm기지국 (IOI20_stations)C++17
0 / 100
3051 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) typedef long long ll; typedef std::pair<ll,ll> pll; using namespace std; const int N = 1024; vector<int> A[N]; int ans[N]; void dfs(int v, int p, int &t, int c) { if (!c) ans[v] = t++; for (int u : A[v]) if (u != p) dfs(u, v, t, !c); if (c) ans[v] = t++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { Loop (i,0,n-1) { int x = v[i], y = u[i]; A[x].push_back(y); A[y].push_back(x); } int dard = 0; dfs(0, -1, dard, 0); return vector<int>(ans, ans+n); } int find_next_station(int s, int t, std::vector<int> c) { sort(c.begin(), c.end()); if (s == 0) return *lower_bound(c.begin(), c.end(), t); if (c[0] > s) { if (t < s || t > c.end()[-2]) return c.back(); return *lower_bound(c.begin(), c.end()-1, t); } else { if (t > s || t < c[1]) return c[0]; return *(upper_bound(c.begin()+1, 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...