제출 #954952

#제출 시각아이디문제언어결과실행 시간메모리
954952irmuun기지국 (IOI20_stations)C++17
5 / 100
593 ms1192 KiB
#include<bits/stdc++.h> #include "stations.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() vector<int>label(int n,int k,vector<int>u,vector<int>v){ vector<int>l(n); vector<int>adj[n]; for(int i=0;i<n-1;i++){ adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } vector<int>ord; function <void(int,int)> dfs=[&](int x,int p){ ord.pb(x); for(auto y:adj[x]){ if(y!=p){ dfs(y,x); } } }; for(int i=0;i<n;i++){ if(adj[i].size()==1){ dfs(i,-1); break; } } for(int i=0;i<n;i++){ l[ord[i]]=i; } return l; } int find_next_station(int s,int t,vector<int>c){ if(t<s) return c[0]; return c.back(); }
#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...