Submission #1297632

#TimeUsernameProblemLanguageResultExecution timeMemory
1297632lukaye_19Stations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; int t = 1; void DFS(int node,int parent,vector<vector<int>>&adj,vector<int>&tin,vector<int>&tout) { tin[node] = t++; for (int nenode : adj[node]) { if (nenode != parent) { DFS(nenode,node,adj,tin,tout); } } tout[node] = t - 1; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { vector<int>labels(n); vector<vector<int>>adj(n - 1); for (int i = 0; i < n - 1; i++) { int u1 = u[i]; int v1 = v[i]; adj[u1].push_back(v1); adj[v1].push_back(u1); } vector<int>tin(n); vector<int>tout(n1); DFS(0,0,adj,tin,tout); for (int i = 1; i < n; i++) { labels[i] = tin[i]; } return labels; } int find_next_station(int s, int t, vector <int> c) { int next = -1; for (int st : c) { if (st <= t) next = st; } if (next == -1) next = c[0]; return next; }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:39:19: error: 'n1' was not declared in this scope; did you mean 'n'?
   39 |   vector<int>tout(n1);
      |                   ^~
      |                   n