제출 #1024329

#제출 시각아이디문제언어결과실행 시간메모리
1024329Ahmed_Solyman기지국 (IOI20_stations)C++14
0 / 100
3066 ms2097152 KiB
#include <bits/stdc++.h> //#include "stub.cpp" using namespace std; typedef long long ll; vector<vector<int>>adj; int mark=0; vector<int>in,out; void dfs(int node,int par){ in[node]=mark++; for(auto i:adj[node]){ if(i!=par)dfs(i,node); } } vector<int> label(int n, int k, vector<int> u, vector<int> v){ mark=0; adj.resize(n+5); in.resize(n+5); out.resize(n+5); for(int i=0;i<n-1;i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } for(int i=0;i<n;i++){ if(adj[i].size()==1){ dfs(i,i);break; } } vector<int>ret(n); for(int i=0;i<n;i++)ret[i]=in[i]; return ret; } bool is_anc(int u,int v){ if(u<=v)return 1; return 0; } int find_next_station(int s, int t,vector<int> c){ int p=0; for(auto i:c){ if(is_anc(i,s)){ p=i;continue; } if(is_anc(i,t)){ return i; } } return p; }
#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...