제출 #580281

#제출 시각아이디문제언어결과실행 시간메모리
580281pirhosig기지국 (IOI20_stations)C++17
0 / 100
913 ms636 KiB
#include "stations.h" #include <bits/stdc++.h> #define R(a) for (int i = 0; i < a; ++i) #define RR(a) for (int j = 0; j < a; ++j) using namespace std; void name(vector<int> adj[], vector<int>& val, int& cont, bool even, int p, int n) { if (!even) val[n] = cont++; for (int a : adj[n]) { if (a != p) name(adj, val, cont, !even, n, a); } if (even) val[n] = cont++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int> adj[n]; R(n - 1) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } vector<int> ret(n); int cont = 0; name(adj, ret, cont, false, -1, 0); // cerr << "L"; // R(n) { // cerr << " " << ret[i]; // } // cerr << endl; return ret; } int find_next_station(int s, int t, vector<int> c) { // cerr << "S " << s << " " << t << " " << c[0] << endl; int m = c.size(); if (m == 1) return c[0]; if (s == 0) { for (int i = m - 1; i >= 0; --i) { if (c[i] >= t) return c[i]; } } else { bool yea = true; for (int a : c) { if (a > s) { yea = false; break; } } if (yea) { // cerr << "V " << (c[0] < t) << (t < s) << endl; if (!(c[0] < t && t < s)) return c[0]; for (int i = 1; i < m - 1; ++i) { if (t < c[i + 1]) return c[i]; } return c[m - 1]; } else { if (s < t && t < c[m - 1]) { for (int i = m - 2; i >= 0; --i) { if (t <= c[i]) return c[i]; } } return c[m - 1]; } } return -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...