Submission #314846

# Submission time Handle Problem Language Result Execution time Memory
314846 2020-10-21T13:26:09 Z LethalPuppy Traffic (IOI10_traffic) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "traffic.h>
using namespace std;

const int N = 1e6+5;
vector<int> neighbours[N];
int fans[N], total = 0, res = 0, traffic[N], posans[N], nums = 2e9+1;

void dfs(int u, int v) {
    for (auto &x: neighbours[u]) {
        if (x == v)
            continue;
        dfs(x, u);
        traffic[u] += traffic[x];
        posans[u] = max(posans[u], traffic[x]);
    }
    posans[u] = max(posans[u], total - traffic[u] - fans[u]);
    traffic[u] += fans[u];
}
int LocateCenter(int n, int p[], int s[], int d[]) {
    for (int i = 0; i < n - 1; ++i) {
        neighbours[s[i]].push_back(d[i]), neighbours[d[i]].push_back(s[i]);
        fans[i] = p[i], total += p[i];
    }
    fans[n - 1] = p[n - 1], total += p[n - 1];
    dfs(0, -1);
    for (int i = 0; i < n; ++i) {
        if (nums > posans[i]) {
            nums = posans[i];
            res = i;
        }
    }
    return res;
}

Compilation message

traffic.cpp:2:10: warning: missing terminating " character
    2 | #include "traffic.h>
      |          ^
traffic.cpp:2:10: error: #include expects "FILENAME" or <FILENAME>
    2 | #include "traffic.h>
      |          ^~~~~~~~~~~