Submission #348370

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3483702021-01-14 19:31:51dennisstarStations (IOI20_stations)C++17
100 / 100
1180 ms1248 KiB
#include <bits/stdc++.h>
#include "stations.h"
using namespace std;
const int MX = 1e3 + 5;
vector<int> L, adj[MX];
int O;
void dfs(int n, int p, int d) {
if (d&1) L[n]=O++;
for (auto &i:adj[n]) if (i!=p) dfs(i, n, d+1);
if ((d-1)&1) L[n]=O++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
O=0;
for (int i=0; i<n; i++) adj[i].clear();
L.resize(n);
for (int i=0; i<n-1; i++)
adj[u[i]].emplace_back(v[i]),
adj[v[i]].emplace_back(u[i]);
dfs(0, -1, 1);
return L;
}
int find_next_station(int s, int t, vector<int> c) {
if (c.size()==1) return c[0];
if (c[0]>s) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...