제출 #979304

#제출 시각아이디문제언어결과실행 시간메모리
979304Zicrus기지국 (IOI20_stations)C++17
5 / 100
684 ms1044 KiB
#include <bits/stdc++.h> #include "stations.h" using namespace std; typedef long long ll; vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<ll> degree(n); vector<vector<int>> adj(n); for (ll i = 0; i < n-1; i++) { degree[u[i]]++; degree[v[i]]++; adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } ll one = 0; for (ll i = 0; i < n; i++) { if (degree[i] == 1) { one = i; break; } } vector<int> res(n); ll prev = -1; for (ll i = 0; i < n; i++) { res[one] = i; for (auto &e : adj[one]) { if (e != prev) { prev = one; one = e; break; } } } return res; } int find_next_station(int s, int t, vector<int> c) { if (t > s) return s + 1; else return s - 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...