逆元模板

求逆元模板 递推求逆元 int int rep(i,2 inv[i] = inv[mod%i]*(mod-mod/i)%mod; } 费马小定理求逆元 ll extend_gcd if if x = 1 return } ll d = extend_gcd(b,a%b,y,x); y -= a/b*x; return } ll mod_reverse ll x,y; ll d = extend_gcd(a,n,x,y); if else } 逆元模板 https://www.cheasim.com/acm%E6%A8%A1%E6%9D%BF/2018/08/19/%E9%80%86%E5%85%83%E6%A8%A1%E6%9D%BF.html 作者 CheaSim 发布于 2018-08-19 更新于 2018-08-19 许可协议

August 19, 2018 · 1 min · CheaSim

codeforcesPoints

codeforcesPoints 题意 给出几个点,让你求出在某个点的右边和上面最接近他的点是哪一个点。 题解 线段树+set应用 对$x$进行离散化处理,对于每一个$x$进行建一个set,用线段树维护$x$之间的$y$的最大值。对于给出点的右上点,我们可以用二分来set搜索,还有在线段树中优先搜索左边靠近给出点的点。 ...

August 18, 2018 · 1 min · CheaSim