CF - Cellular Network

Author: Benjamin Qi

Solution 1 - Using a Set

Official Editorial

Solution 2 - Two Pointers

1#include <bits/stdc++.h>
2using namespace std;
3
4typedef long long ll;
5typedef pair <int, int> pii;
6typedef vector<int> vi;
7
8#define mp make_pair
9#define pb push_back
10

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!

Give Us Feedback on CF - Cellular Network!