ACPC 2017 - Lane Switching
Author: Benjamin Qi
Time Complexity:
Similar to the previous two problems in this module, we can binary search on the answer. However, there's a bit more implementation involved because we need to construct the graph first. Each vertex in the graph corresponds to a range of unoccupied space in a lane, and we draw an edge between two vertices with weight equal to the length of their vertical intersection.
#include <bits/stdc++.h>using namespace std;using ll = long long;using ld = long double;using db = double;using str = string; // yay python!using pi = pair<int, int>;using pl = pair<ll, ll>;
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!