Submission #468364

#TimeUsernameProblemLanguageResultExecution timeMemory
468364kessidoStations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define ll long long int #define vll vector<ll> #define vi vector<int> #define vvi vector<vi> #define pi pair<int, int> #define pll pair<ll, ll> #define all(x) (x).begin(), (x).end() #define fori(i,n) for(int i = 0; i < int(n); ++i) vi label(int n, int k, const vi& u, const vi& v) { vvi e(n); fori(i,n-1){ e[u[i]].push_back(v[i]); e[v[i]].push_back(u[i]); } int cur_label = 0; vi res(n, -1); auto dfs = [&](auto& self, int i, int parent) -> void { res[i] = cur_label++; for(int j : e[i]) { if(j==parent) continue; self(self, j, i); } }; dfs(dfs, 0, -1); return res; } int find_next_station(int s, int t, vi c) { sort(all(c)); if(t < s) return c[0]; // parent; int i = 1; while(i < c.size() && c[i] >= t) i++; return c[i-1]; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:37:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     while(i < c.size() && c[i] >= t) i++;
      |           ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccCyWPwG.o: in function `main':
stub.cpp:(.text.startup+0x2b5): undefined reference to `label(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status