제출 #1024269

#제출 시각아이디문제언어결과실행 시간메모리
1024269Ahmed_Solyman기지국 (IOI20_stations)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N=1005; vector<int>adj[N]; int l[N],r[N],mark=0; void dfs(int node,int par){ l[node]=mark++; for(auto i:adj[node]) if(i!=par)dfs(i); r[node]=mark-1; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ vector<int>adj[n]; for(int i=0;i<n-1;i++){ adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } dfs(0,0); vector<int>ret; for(int i=0;i<n;i++){ ret.push_back(l[node]*1000+r[node]); } } bool is_anc(int u,int v){ v/=1000; int in=u/1000,out=u%1000; if(v>=in && v<=out)return 1; else return 0; } int find_next_station(int s, int t,vector<int> c){ int root=0; for(auto i:c){ if(is_anc(i,t))return i; else if(is_anc(i,s))root=i; } return root; }

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

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:12:24: error: too few arguments to function 'void dfs(int, int)'
   12 |         if(i!=par)dfs(i);
      |                        ^
stations.cpp:9:6: note: declared here
    9 | void dfs(int node,int par){
      |      ^~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:24:25: error: 'node' was not declared in this scope
   24 |         ret.push_back(l[node]*1000+r[node]);
      |                         ^~~~
stations.cpp:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
   26 | }
      | ^