CF - USB vs. PS/2

Author: Benjamin Qi

Official Editorial

Greedy

As described in editorial.

1#include <bits/stdc++.h>
2#include <ext/pb_ds/tree_policy.hpp>
3#include <ext/pb_ds/assoc_container.hpp>
4
5using namespace std;
6using namespace __gnu_pbds;
7
8typedef long long ll;
9typedef vector<int> vi;
10typedef pair<int, int> pii;

Two Pointers

As described in editorial.

1#include <bits/stdc++.h>
2using namespace std;
3
4using ll = long long;
5using ld = long double;
6using db = double;
7using str = string; // yay python!
8
9using pi = pair<int,int>;
10using 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!

Give Us Feedback on CF - USB vs. PS/2!