Submission #706807

#TimeUsernameProblemLanguageResultExecution timeMemory
706807rafatoaPaint By Numbers (IOI16_paint)C++17
Compilation error
0 ms0 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, int)> dfs = [&](int s, int e, int d){ if(d%2 == 0) l[s] = aux++; for(auto u:adj[s]) if(u != e) dfs(u, s, d+1); if(d%2 == 1) l[s] = aux++; }; dfs(0, -1, 0); return l; } int find_next_station(int s, int t, vector<int> c){ sort(c.begin(), c.end()); int n = c.size(); if(n == 1) return c[0]; //Out of bounds if(s < c[0]){ if(t < s || t > c[n-2]) return c[n-1]; for(int i=0; i<n; i++) if(c[i] >= t) return c[i]; } else { if(t > s || t < c[1]) return c[0]; for(int i=2; i<n; i++) if(c[i] > t) return c[i-1]; return c[n-1]; } }

Compilation message (stderr)

paint.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
paint.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^
/usr/bin/ld: /tmp/cc71tU47.o: in function `main':
grader.cpp:(.text.startup+0x20b): undefined reference to `solve_puzzle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status