YS - Static Range Inversions Query
Author: Benjamin Qi
Solution 1
Naive solution as described in the linked CF Blog.
Time Complexity:
#include <algorithm>#include <iostream>#include <vector>using namespace std;using ll = long long;using P = pair<int, int>;const int N = 1e5 + 1;const int S = 300;
Solution 2
"sweepline mo"
Time Complexity:
#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!