Submission #1024335

#TimeUsernameProblemLanguageResultExecution timeMemory
1024335Ahmed_SolymanStations (IOI20_stations)C++14
0 / 100
618 ms684 KiB
#include <bits/stdc++.h> using namespace std; #include "stations.h" typedef long long ll; vector<vector<int>>adj; int mark=0; vector<int>in,vis; void dfs(int node,int par){ in[node]=mark++;vis[node]=1; for(auto i:adj[node]){ if(!vis[i])dfs(i,node); } } vector<int> label(int n, int k, vector<int> u, vector<int> v){ mark=0; adj.resize(n); in.resize(n);vis.resize(n); 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; } } return in; } int find_next_station(int s, int t,vector<int> c){ int p=0; for(auto i:c){ if(i<=s){ p=i;continue; } if(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...