제출 #768047

#제출 시각아이디문제언어결과실행 시간메모리
7680473RR0R404기지국 (IOI20_stations)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> child(1000,0); vector<int> label(int n,int k,vector<int> u,vector<int> v) { vector<vector<int>> v(n); vector<int> L(n,0); int l=0; set<int> visited; int dfs(int node,int d) { visited.insert(node) L[node] = l l++; int b=0; for(auto p: v[node]) { if(viseted.contains(p)) { continue; } child[d] += dfs(p,l) } return child[d]+1; } for(auto i: v) { if(i.size() == 1) dfs(i,0) break; } return L } int find_next_station(int s, int t, vector<int> c) { sort(c.begin(),c.end()); if(s+child[s]<t) { return c[0]; } if(s>t) { return c[0]; } return *(upper_bound(c.begin(),c.end(),t)-1); }

컴파일 시 표준 에러 (stderr) 메시지

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:6:25: error: declaration of 'std::vector<std::vector<int> > v' shadows a parameter
    6 |     vector<vector<int>> v(n);
      |                         ^
stations.cpp:4:57: note: 'std::vector<int> v' previously declared here
    4 | vector<int> label(int n,int k,vector<int> u,vector<int> v)
      |                                             ~~~~~~~~~~~~^
stations.cpp:11:5: error: a function-definition is not allowed here before '{' token
   11 |     {
      |     ^
stations.cpp:29:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   29 |         dfs(i,0)
      |         ^~~
      |         ffs
stations.cpp:32:13: error: expected ';' before '}' token
   32 |     return L
      |             ^
      |             ;
   33 | }
      | ~            
stations.cpp:8:9: warning: unused variable 'l' [-Wunused-variable]
    8 |     int l=0;
      |         ^