제출 #617343

#제출 시각아이디문제언어결과실행 시간메모리
617343DanShaders기지국 (IOI20_stations)C++17
0 / 100
3046 ms2097152 KiB
//Fgrader.cpp #include "stations.h" #include <bits/stdc++.h> using namespace std; #define x first #define y second using ll = long long; using ld = long double; #define all(x) begin(x), end(x) #define sz(x) ((int) (x).size()) const int N = 1010; vector<int> g[N]; vector<int> ans; int timer = 0; void dfs(int u = 0, int p = -1, int depth = 1) { if (depth) { ans[u] = timer++; } for (int v : g[u]) { if (v != p) { dfs(v, u, depth ^ 1); } } if (!depth) { ans[u] = timer++; } } vector<int> label(int n, int, vector<int> u, vector<int> v) { for (int i = 0; i < n - 1; ++i) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } ans.resize(n); dfs(); return ans; } int find_next_station(int s, int t, vector<int> c) { if (sz(c) == 1) { return c[0]; } if (!s) { return *lower_bound(all(c), t); } if (s < c[0]) { if (t < s || t > c[sz(c) - 2]) { return c.back(); } else { return *lower_bound(all(c), t); } } else { if (t < c[1] || t > s) { return c[0]; } else { return *--upper_bound(all(c), t); } } }
#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...