Submission #1186942

#TimeUsernameProblemLanguageResultExecution timeMemory
1186942hengliaoStations (IOI20_stations)C++20
5 / 100
300 ms584 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define vll vector<ll> #define pll pair<ll, ll> #define pb push_back typedef int ll; namespace{ const ll dumb=1000; ll timer; } void dfs(ll cur, ll par, vll &re, vll &sz, vector<vll> &adj){ sz[cur]=1; re[cur]=timer; timer++; for(auto &chd:adj[cur]){ if(chd==par) continue; dfs(chd, cur, re, sz, adj); sz[cur]+=sz[chd]; } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<vll> adj(n); vll re(n); vll sz(n); for(ll i=0;i<n-1;i++){ adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } ll root; for(ll i=0;i<n;i++){ if((ll) adj[i].size()<=1){ root=i; break; } } timer=0; dfs(root, -1, re, sz, adj); // for(ll i=0;i<n;i++){ // re[i]+=dumb*sz[i]; // } return re; } int find_next_station(int s, int t, vector<int> c) { if(t>s){ for(auto &it:c){ if(it>s){ return it; } } } else{ for(auto &it:c){ if(it<s){ return it; } } } }

Compilation message (stderr)

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