Submission #616687

#TimeUsernameProblemLanguageResultExecution timeMemory
616687John3_141592Stations (IOI20_stations)C++14
10 / 100
962 ms632 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector <int> grafo[1003]; int arr[1003],C; bool vis[1003]; void dfs(int node){ vis[node]=true,arr[node]=0; for(auto i:grafo[node]) if(!vis[i]) dfs(i),arr[node]|=arr[i]; arr[node]|=(1<<C),C++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for(int i=0;i<n;i++) grafo[i].clear(); for(int i=0;i<n-1;i++) grafo[u[i]].push_back(v[i]),grafo[v[i]].push_back(u[i]); fill(arr,arr+n+1,0); fill(vis,vis+n+1,false); C=0,dfs(0); vector <int> vec; for(int i=0;i<n;i++) vec.push_back(arr[i]); return vec; } int find_next_station(int s, int t, std::vector<int> c) { if(c.size()==1) return c[0]; for(auto i:c) if((i&t)==t) return i; 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...