제출 #370905

#제출 시각아이디문제언어결과실행 시간메모리
370905XEMPLI5Traffic (IOI10_traffic)C++17
컴파일 에러
0 ms0 KiB
#include "traffic.h" #include <bits/stdc++.h> using namespace std; int fans, mxN = 1e6; fans = 0; vector<vector<int>> g(mxN); vector<int> citySize(mxN), subTreeSize(mxN), maxTraffic(mxN), people(mxN); void dfs(int cur, int par){ for(auto e: g[cur]) { if(e == par) return; dfs(e,cur); subTreeSize[cur] += subTreeSize[e]; people[cur] = max(people[cur], subTreeSize[e]); } people[cur] = max(people[cur], fans - subTreeSize[cur] - citySize[cur]); subTreeSize[cur] += citySize[cur]; } int LocateCentre(int n, int p[], int d[], int s[]){ for(int i=0; i<n-1; i++){ g[s[i]].push_back(d[i]); g[d[i]].push_back(s[i]); } for(int i=0; i<n; i++) { fans += p[i]; citySize[i] = p[i]; } dfs(0,0); int ans = 0, minPeople = 1e9; for(int i=0; i<n; i++){ if(people[i] < minPeople) { minPeople = people[i]; ans = i; } } return ans; }

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

traffic.cpp:7:1: error: 'fans' does not name a type
    7 | fans = 0;
      | ^~~~