Submission #403157

#TimeUsernameProblemLanguageResultExecution timeMemory
403157NafeeszxTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include "traffic.h" #include <bits/stdc++.h> using namespace std; const int MX = 1e6; vector<int> adj[MX]; vector<int> nodes(MX); vector<int> children(MX); vector<int> people(MX, 0); int citizen = 0; void dfs(int u, int p){ trav(v, adj[u]){ if(v != p){ dfs(v, u); children[u] += children[v]; people[u] = max(people[u], children[v]); } } people[u] = max(people[u], citizen - children[u] - nodes[u]); children[u] += nodes[u]; } int LocateCentre(int n, int p[], int s[], int d[]){ for(int i = 0; i < n; ++i){ nodes[i] = p[i]; citizen += p[i]; } for(int i = 0; i < n - 1; ++i){ adj[s[i]].push_back(d[i]); adj[d[i]].push_back(s[i]); } int minpeople = 2e9 + 1, res = 0; for(int i = 0; i < n; ++i){ if(people[i] < minpeople){ res = i; minpeople = people[i]; } } return res; }

Compilation message (stderr)

traffic.cpp: In function 'void dfs(int, int)':
traffic.cpp:15:10: error: 'v' was not declared in this scope
   15 |     trav(v, adj[u]){
      |          ^
traffic.cpp:15:5: error: 'trav' was not declared in this scope
   15 |     trav(v, adj[u]){
      |     ^~~~