Submission #430731

#TimeUsernameProblemLanguageResultExecution timeMemory
430731JUANDI321Stations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include "stations.h" #include <vector> #include <iostream> #include <cstring> using namespace std; vector<vector<int>> g(1000+10); vector<int> l(1000 +10); bool ch[1010]; int j = 0; void dfs(int node); { if(ch[node])return; ch[node]=true; l[j] = node; //cout<<node<<endl; for(auto y : g[node]) { if(!ch[y]) { dfs(y); j++; } } } 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++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } int spn = 0; for(int i = 0; i < n; i++) { if(g[i].size() == 1) { spn = i; break; } } dfs(spn);//cout<<"hola"<<endl; for (int i = 0; i < n; i++) { labels[l[i]] = i; //cout<<"l[i] "<<l[i]<<" i "<<i<<endl; } //cout<<"-----------"<<endl; memset(ch, false, sizeof(ch)); for(int i=0; i<n; i++) g[i].clear(); return labels; }

Compilation message (stderr)

stations.cpp:12:1: error: expected unqualified-id before '{' token
   12 | {
      | ^