제출 #406518

#제출 시각아이디문제언어결과실행 시간메모리
406518benkTraffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
#include "traffic.h" #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define pb push_back #define sz(x) (int)(x.size()) #define ll long long #define fi first #define se second #define lbd lower_bound #define ubd upper_bound const int MOD = 1e9 + 7; const double eps = 1e-10; const long long INF = 1e18; const int N = 1e6 + 10; int tot; vector<int> adj[N], ch(N), peop(N), curr(N); vector<bool> vis(N); void dfs(int x) { vis[x] = 1; for (auto it : adj[x]) { vis[it] = 1; dfs(it); ch[x] += ch[it]; peop[x] = max(peop[x], ch[x]); // max of all ch } ch[x] += curr[x]; peop[x] = max(peop[x], tot - ch[x]); // either from ancestors or ch } int LocateCentre(int n, int p[], int s[], int d[]) { for (int i = 0; i < n - 1; i++) { adj[s[i]].pb(d[i]); adj[d[i]].pb(s[i]); } for (int i = 0; i < n; i++) { tot += p[i]; curr[i] = p[i]; } dfs(0, p); ll ans = INT_MAX, res = -1; for (int i = 0; i < n; i++) { if (ans > peop[i]) { ans = peop[i]; res = i; } } return res; }

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

traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:44:10: error: too many arguments to function 'void dfs(int)'
   44 |  dfs(0, p);
      |          ^
traffic.cpp:22:6: note: declared here
   22 | void dfs(int x) {
      |      ^~~