Table of Contents

ExplanationImplementation

Official Editorial

Explanation

This section is not complete.

Any help would be appreciated! Just submit a Pull Request on GitHub.

Editorial

Implementation

Time Complexity: O(N)\mathcal{O}(N)

#include "traffic.h"
#include <bits/stdc++.h>
using namespace std;
const int MX = 1e6;
const int INF = 2e9 + 1;
int fans = 0;
vector<int> g[MX], nodes(MX), people(MX), children(MX);

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!