제출 #705749

#제출 시각아이디문제언어결과실행 시간메모리
705749PenguinsAreCute기지국 (IOI20_stations)C++17
0 / 100
4 ms772 KiB
#include <vector> using namespace std; #define MAXN 1005 vector<int> a[MAXN]; int pre[MAXN]; int c; void dfs(int x, int p, bool h) { if(!h) {pre[x] = c; c++;} for(auto i: a[x]) if(i != p) dfs(i, x, !h); if(h) {pre[x] = c; c++;} } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { c = 0; for(int i = 0; i < MAXN; i++) a[i].clear(); std::vector<int> labels(n); for(int i = 0; i < n - 1; i++) { a[u[i]].push_back(v[i]); a[v[i]].push_back(u[i]); } dfs(0, -1, false); for (int i = 0; i < n; i++) { labels[i] = pre[i]; } return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(s / 1000 > t / 1000 || t / 1000 > s % 1000) { for(auto v: c) if(v / 1000 <= s / 1000 && s / 1000 <= v % 1000) return v; } for(auto v: c) if(v / 1000 <= t / 1000 && t / 1000 <= v % 1000 && !(v / 1000 <= s / 1000 && s / 1000 <= v % 1000)) return v; }

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

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