제출 #836071

#제출 시각아이디문제언어결과실행 시간메모리
836071maomao90기지국 (IOI20_stations)C++17
76 / 100
736 ms816 KiB
// I can do all things through Christ who strengthens me // Philippians 4:13 #include "stations.h" #include <bits/stdc++.h> using namespace std; #define REP(i, j, k) for (int i = j; i < (k); i++) #define RREP(i, j, k) for (int i = j; i >= (k); i--) template <class T> inline bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define ALL(x) x.begin(), x.end() #define SZ(x) (int) x.size() #define pb push_back typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; typedef tuple<int, int, int> iii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005; const int MAXN = 500005; vi label(int n, int k, vi u, vi v) { vector<vi> adj(n); REP (i, 0, n - 1) { adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } int ptr = 10; vi l(n); vi d(n); function<void(int, int)> dfs = [&] (int u, int p) { if (d[u] == 0) { l[u] = ptr++; } for (int v : adj[u]) { if (v == p) { continue; } d[v] = d[u] ^ 1; dfs(v, u); } if (d[u] == 1) { l[u] = ptr++; } }; dfs(0, -1); return l; } int find_next_station(int s, int t, vi c) { if (SZ(c) == 1) { return c[0]; } if (s > c.back()) { if (t < c[1] || t > s) { return c[0]; } RREP (i, SZ(c) - 1, 1) { if (c[i] <= t) { return c[i]; } } assert(0); } else { assert(s < c[0]); if (s != 0 && (t < s || t > c[SZ(c) - 2])) { return c.back(); } REP (i, 0, SZ(c) - (s > 0)) { if (t <= c[i]) { return c[i]; } } assert(0); } }
#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...