Submission #616720

#TimeUsernameProblemLanguageResultExecution timeMemory
616720John3_141592Stations (IOI20_stations)C++14
0 / 100
1057 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector <int> grafo[1003]; int arr[1003]; bool vis[1003]; void dfs(int node,int c,int C){ vis[node]=true; if(c) arr[node]=C; for(auto i:grafo[node]) if(!vis[i]) dfs(node,c^1,C+1); if(!c) arr[node]=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); dfs(0,0,0); vector <int> solve; for(int i=0;i<n;i++) solve.push_back(arr[i]); return solve; } int find_next_station(int s, int t, std::vector<int> c) { if(s<c[0]) for(auto i:c) if(i>t) return i; reverse(c.begin(),c.end()); for(auto i:c) if(i<t) return i; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#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...