Submission #757656

#TimeUsernameProblemLanguageResultExecution timeMemory
7576561binStations (IOI20_stations)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "stations.h" using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 1005; int t, L[NMAX]; vector<int> adj[NMAX]; void dfs(int x, int p, int f){ if(!f) L[x] = t++; for(int&nx : adj[x]) if(nx != p) dfs(nx, x, !f, labels); if(f) labels[x] = t++; return; } vector<int>label(int n, int k, vector<int> u, vector<int> v) { vector<int> labels(n); for(int i = 0; i < n - 1; i++){ adj[u[i]].emplace_back(v[i]); adj[v[i]].emplace_back(u[i]); } t = 0; dfs(0, -1, 0); for(int i = 0; i < n; i++) { labels[i] = L[i]; adj[i].clear(); } return labels; } int find_next_station(int s, int t, vector<int> c) { int sz = c.size(); if(s < c[0]){ for(int i = 0; i < sz; i++){ int l = !i ? s : c[i - 1] + 1, r = c[i]; if(t >= l && t <= r) return c[i]; } return c.back(); } else{ for(int i = 1; i < sz; i++){ int l = c[i], r = (i == sz - 1 ? s - 1: c[i + 1] - 1); if(t >= l && t <= r) return c[i]; } return c[0]; } }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int, int, int)':
stations.cpp:15:36: error: 'labels' was not declared in this scope; did you mean 'label'?
   15 |         if(nx != p) dfs(nx, x, !f, labels);
      |                                    ^~~~~~
      |                                    label
stations.cpp:16:11: error: 'labels' was not declared in this scope; did you mean 'label'?
   16 |     if(f) labels[x] = t++;
      |           ^~~~~~
      |           label