Submission #614011

#TimeUsernameProblemLanguageResultExecution timeMemory
614011Dan4LifeStations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define pb push_back vector<int> adj[1001], col; int lab = 0; void dfs(int s, int p=-1) { col[s]=lab++; for(auto u : adj[s]) if(u!=p) dfs(u, s, col); } vector<int> label(int n, int k, vector<int> a, vector<int> b) { col.resize(n,0); lab = 0; col.clear(); for(int i = 0; i < n; i++) adj[i].clear(); for (int i = 0; i < n-1; i++) { adj[a[i]].pb(b[i]); adj[b[i]].pb(a[i]); } for(int i = 0; i < n; i++){ if(adj[i].size()!=1) continue; dfs(i); return col; } } int find_next_station(int s, int t, vector<int> c) { if(c.size()==1)return c[0]; for(auto u : c) if(u==t) return u; if(s<t) return c[1]; return c[0]; }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:11:25: error: too many arguments to function 'void dfs(int, int)'
   11 |   if(u!=p) dfs(u, s, col);
      |                         ^
stations.cpp:7:6: note: declared here
    7 | void dfs(int s, int p=-1)
      |      ^~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^