제출 #986580

#제출 시각아이디문제언어결과실행 시간메모리
986580CSQ31기지국 (IOI20_stations)C++17
0 / 100
584 ms1088 KiB
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int>adj[1000]; int tin[1000],tout[1000]; int timer = -1; void dfs(int v,int u){ tin[v] = ++timer; for(int x:adj[v]){ if(x==u)continue; dfs(x,v); } tout[v] = timer; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for(int i=0;i<n;i++)adj[i].clear(); vector<int>lab(n); for(int i=0;i+1<n;i++){ adj[v[i]].push_back(u[i]); adj[u[i]].push_back(v[i]); } timer = -1; dfs(0,-1); for(int i=0;i<n;i++)lab[i] = 1000*tin[i] + tout[i]; return lab; } int find_next_station(int s, int t, vector<int> c) { int tl = t/1000; int tr = t%1000; int sl = s/1000; int sr = s%1000; bool out = 1; if(sl <= tl && tr <= sr)out = 0; for(int x:c){ int l = x/1000; int r = x%1000; if(l <= tl && tr <= r)return x; if(out && l <= sl && sr <= r)return x; } }

컴파일 시 표준 에러 (stderr) 메시지

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