Submission #601895

#TimeUsernameProblemLanguageResultExecution timeMemory
601895FatihSolakStations (IOI20_stations)C++17
5 / 100
934 ms856 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define N 1000 vector<int> adj[N]; int tin[N]; int tout[N]; int timer = 0; void dfs(int v,int par){ tin[v] = timer++; for(auto u:adj[v]){ if(u == par)continue; dfs(u,v); } tout[v] = timer-1; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for(int i = 0;i<n;i++){ adj[i].clear(); } 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){ timer = 0; dfs(i,-1); break; } } vector<int> labels(n); for (int i = 0; i < n; i++) { labels[i] = tin[i]; } return labels; } int find_next_station(int s, int t, vector<int> c){ for(auto u:c){ if(s <= u && u <= t) return u; if(s >= u && u >= t) return u; } }

Compilation message (stderr)

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