CSES - List Removals
Author: Benjamin Qi
Solution 1
Use a rope.
1#include <ext/rope>2#include <bits/stdc++.h>3using namespace std;4using namespace __gnu_cxx;56using ll = long long;7using ld = long double;8using db = double;9using str = string; // yay python!10
Solution 2
Use an indexed set.
1#include <bits/stdc++.h>2using namespace std;34using ll = long long;5using ld = long double;6using db = double;7using str = string; // yay python!89using pi = pair<int,int>;10using pl = pair<ll,ll>;
Solution 3
Binary search on a BIT.
1#include <bits/stdc++.h>2using namespace std;34using ll = long long;5using ld = long double;6using db = double;7using str = string; // yay python!89using 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!