제출 #573208

#제출 시각아이디문제언어결과실행 시간메모리
573208Trisanu_DasTraffic (IOI10_traffic)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "traffic.h" using namespace std; #define int long long int int peeps = 0; vector<int> adj[(int)1e6], city((int)1e6), peepsInPath((int)1e6), numOfChild((int)1e6); void dfs(int u, int parent){ for(int v : adj[u]){ if(v == parent) continue; dfs(v, u); numOfChild[u] += numOfChild[v]; peepsInPath[u] = max(peepsInPath[u], peepsInPath[v]); } peepsInPaths[u] = max(peepsInPath[u], peeps - numOfChild[u] - city[u]); children[u] += nodes[u]; } int LocateCentre(int n, int p[], int s[], int d[]){ for(int i = 0; i < n; i++){ peeps += p[i]; city[i] = p[i]; } for(int i = 0; i < n - 1; i++){ adj[s[i]].push_back(d[i]); adj[d[i]].push_back(s[i]); } dfs(0, -1); int ans = -1, cong = INT_MAX; for(int i = 0; i < n; i++){ if(peepsInPath[i] < cong){ ans = i; cong = peepsInPath[i]; } } return ans; }

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

traffic.cpp: In function 'void dfs(long long int, long long int)':
traffic.cpp:15:3: error: 'peepsInPaths' was not declared in this scope; did you mean 'peepsInPath'?
   15 |   peepsInPaths[u] = max(peepsInPath[u], peeps - numOfChild[u] - city[u]); children[u] += nodes[u];
      |   ^~~~~~~~~~~~
      |   peepsInPath
traffic.cpp:15:75: error: 'children' was not declared in this scope
   15 |   peepsInPaths[u] = max(peepsInPath[u], peeps - numOfChild[u] - city[u]); children[u] += nodes[u];
      |                                                                           ^~~~~~~~
traffic.cpp:15:90: error: 'nodes' was not declared in this scope
   15 |   peepsInPaths[u] = max(peepsInPath[u], peeps - numOfChild[u] - city[u]); children[u] += nodes[u];
      |                                                                                          ^~~~~