Submission #1284557

#TimeUsernameProblemLanguageResultExecution timeMemory
1284557faricaStations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; using vi = vector<int>; vi labels; vector<vi>adjL; int dfs(int pos, int cnt, int prev=-1) { for(int adj: adjL[pos]) { if(adj == prev) continue; cnt = dfs(adj, cnt, pos); } labels[pos] = cnt; return cnt+1; } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { labels.resize(n); adjL.assign(n, vi()); for(int i=0; i<n-1; ++i) { adjL[u[i]].push_back(v[i]); adjL[v[i]].push_back(u[i]); } dfs(0, 0); return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(t > s) return c.back(); int n = (int)c.size(); if(c.back() > s) --n; int nxt = s; for(int i=n-1; i>=0; --i) { if(t >= c[i] && t < nxt) return c[i]; nxt = c[i]; } return c[0] }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:39:20: error: expected ';' before '}' token
   39 |         return c[0]
      |                    ^
      |                    ;
   40 | }
      | ~