Submission #614022

#TimeUsernameProblemLanguageResultExecution timeMemory
614022Dan4Life기지국 (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, int lab){ col[s]=lab; int x = 1000; for(auto u : adj[s]){ if(u==p) continue; if(lab==0) dfs(u,s,x); else dfs(u,s,lab+1); x+=1000; } } vector<int> label(int n, int k, vector<int> a, vector<int> b) { col.resize(n,0); lab = 0; 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]); int ind = 0; for(int i = 0; i < n; i++) if(adj[i].size()>=3) ind = i; dfs(ind,-1,0); return col; } int fi(int x){ while(x>9) x/=10; return x; } int find_next_station(int s, int t, vector<int> c){ if(c.size()==1 or fi(s)!=fi(t)) return c[0]; if(c.size()==2) return c[1]; for(auto u : c) if(fir(u)==fir(s)) return u; }

Compilation message (stderr)

stations.cpp:7:31: error: default argument missing for parameter 3 of 'void dfs(int, int, int)'
    7 | void dfs(int s, int p=-1, int lab){
      |                           ~~~~^~~
stations.cpp:7:21: note: ...following parameter 2 which has a default argument
    7 | void dfs(int s, int p=-1, int lab){
      |                 ~~~~^~~~
stations.cpp: In function 'int fi(int)':
stations.cpp:29:3: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   29 |   while(x>9) x/=10; return x;
      |   ^~~~~
stations.cpp:29:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   29 |   while(x>9) x/=10; return x;
      |                     ^~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:35:12: error: 'fir' was not declared in this scope; did you mean 'fi'?
   35 |         if(fir(u)==fir(s))
      |            ^~~
      |            fi
stations.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^