Submission #524515

#TimeUsernameProblemLanguageResultExecution timeMemory
524515TurkhuuStations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int> label(int n, int k, vector<int> U, vector<int> V){ vector<vector<int>> g(n); for(int i = 0; i < n - 1; i++){[ g[U[i]].push_back(V[i]); g[V[i]].push_back(U[i]); } vector<int> a(n); int x = 0; function<void(int, int)> dfs = [&](int u, int anc){ a[u] = x++; for(int v : g[u]){ if(v != anc){ dfs(v, u); } } }; for(int i = 0; ; i++){ if((int)g[i].size() == 1){ dfs(i, i); return a; } } } int find_next_station(int s, int t, vector<int> c){ if(s > t){ return *min_element(c.begin(), c.end()); } else{ return *max_element(c.begin(), c.end()); } }

Compilation message (stderr)

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:9:6: error: expected ',' before '[' token
    9 |     g[U[i]].push_back(V[i]);
      |      ^
      |      ,
stations.cpp:9:6: error: expected identifier before '[' token
stations.cpp:9:28: error: expected ']' before ';' token
    9 |     g[U[i]].push_back(V[i]);
      |                            ^
      |                            ]
stations.cpp: In lambda function:
stations.cpp:9:28: error: expected '{' before ';' token