제출 #706506

#제출 시각아이디문제언어결과실행 시간메모리
706506rafatoa기지국 (IOI20_stations)C++17
0 / 100
901 ms760 KiB
#include <bits/stdc++.h> using namespace std; vector<int> label(int n, int k, vector<int> u, vector<int> v){ vector<int> l(n); vector<vector<int>> adj(n); for(int i=0; i<n-1; i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } int aux = 0; function<void(int, int)> dfs = [&](int s, int e){ l[s] = aux++; for(auto u:adj[s]) if(u != e) dfs(u, s); }; dfs(0, -1); return l; } int find_next_station(int s, int t, vector<int> c){ if(t < s){ for(auto &x:c) if(x < s) return x; } else { int bst = 0; for(auto &x:c) if(x <= t) bst = max(bst, x); return bst; } }

컴파일 시 표준 에러 (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...