Submission #1174787

#TimeUsernameProblemLanguageResultExecution timeMemory
1174787khanhphucscratchStations (IOI20_stations)C++20
0 / 100
2341 ms2162688 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; //Subtask 1 vector<int> ad[1005], order; int deg[1005]; void dfs(int u, int par) { order.push_back(u); for(int v : ad[u]) if(v != par) dfs(v, u); } vector<int> label(int n, int k, vector<int> a, vector<int> b) { for(int i = 0; i < n-1; i++){ deg[a[i]]++; deg[b[i]]++; ad[a[i]].push_back(b[i]); ad[b[i]].push_back(a[i]); } int root = 0; while(deg[root] == 2) root++; dfs(root, -1); vector<int> ans(n); for(int i = 0; i < n; i++) ans[order[i]] = i; return ans; } int find_next_station(int s, int t, vector<int> c) { if(s < t){ if(c[0] > c[1]) return c[0]; else return c[1]; } else{ if(c[0] > c[1]) return c[1]; else return c[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...