Submission #601890

#TimeUsernameProblemLanguageResultExecution timeMemory
601890FatihSolakStations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define N 1000 vector<int> adj[N]; int tin[N]; int tout[N]; int timer = 0; void dfs(int v,int par){ tin[v] = timer++; for(auto u:adj[v]){ if(u == par)continue; dfs(u,v); } tout[v] = timer-1; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < n; i++) { labels[i] = i; } return labels; } int find_next_station(int s, int t, vector<int> c){ timer = 0; for(int i = 0;i<N;i++){ adj[i].clear(); } for(int i = 0;i<N;i++){ adj[i+1].push_back(i/2); adj[i/2].push_back(i+1); } timer = 0; dfs(0,-1); int x = tin[t]; int par = -1; for(auto u:c){ if(tin[u] < tin[s]) par = u; } for(auto u:c){ if(u == par)continue; int a = tin[u]; int b = tout[u]; if(a <= x && x <= b) return u; } return par; }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:19:3: error: 'labels' was not declared in this scope; did you mean 'label'?
   19 |   labels[i] = i;
      |   ^~~~~~
      |   label
stations.cpp:21:9: error: 'labels' was not declared in this scope; did you mean 'label'?
   21 |  return labels;
      |         ^~~~~~
      |         label