제출 #750313

#제출 시각아이디문제언어결과실행 시간메모리
750313mohav48173기지국 (IOI20_stations)C++14
0 / 100
825 ms732 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int>a[5001]; vector<int> label(int n, int k, vector<int> u, vector<int> v) { int cnt[5001]; for(int i=0;i<n;i++)a[i].clear(); for(int i=0;i<n-1;i++) { a[u[i]].push_back(v[i]); a[v[i]].push_back(u[i]); cnt[u[i]]++; cnt[v[i]]++; } int c=0; for(int i=0;i<n;i++) { if(cnt[i]==1)c=i; } vector<int>ans(n,0); vector<int>used(n,0); for(int i=0;i<n;i++) { used[c]=1; ans[c]=i; for(int j:a[c]) { if(used[j]==0) { used[j]=1; c=j; break; } } } return ans; } int find_next_station(int s, int t, vector<int> c) { sort(c.begin(),c.end()); if(c.size()==1)return c[0]; if(t>s)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...