Skip to content

Instantly share code, notes, and snippets.

View cai-lw's full-sized avatar
🀄
🀆🀆🀆🀅🀅🀅🀄🀄🀄

Liwei Cai cai-lw

🀄
🀆🀆🀆🀅🀅🀅🀄🀄🀄
View GitHub Profile
@cai-lw
cai-lw / 90-typical-problems-066.cpp
Last active June 15, 2021 00:11
競プロ典型90問 066 O(NlogN)
#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
using namespace atcoder;
/*******************************************************************************************
* For i<j, x in the i-th interval [Li,Ri], and y in the j-th interval [Lj,Rj]
* the contribution of (x,y) to the answer is 1/(Ri-Li+1)*(1/(Rj-Lj+1)) if x>y and 0 if x<=y
* Note that 1/(Ri-Li+1) only depends on i, and 1/(Rj-Lj+1) only depends on j
*