之前很多很多紫书上的东西我都忘了…… 抄题解的后果…… 做了一下裸题 https://vjudge.net/problem/UVA-10305 拓扑排序还可以来判环 #include<bits/stdc++.h> #define REP(i, a, b) for(register int i = (a); i < (b); i++) #define _for(i, a, b) for(register int i = (a); i <= (b); i++) using namesp…
\(a ^ n \bmod p\) \(a, p, n \leq 10^9\) 最普通的二进制拆分 #define LL long long LL qpow(LL a, LL n, LL p) { LL ans = 1; for (; n; n >>= 1, a = a * a % p) if (n & 1) ans = ans * a % p; return ans % p; } \(a, p, n \leq 10^{14}\) 底数变大了,直接做\(a * a\)会爆longlon…
好像要1A模板题.完败 下面主要是一波SB错误总结 最小生成树(忘了sort(QwQ)) // It is made by XZZ // Fei Fan Ya Xi Lie~~~ #include<cstdio> #include<algorithm> using namespace std; #define il inline #define rg register #define vd void typedef long long ll; il int gi(){ rg int…
BZOJ 1127 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define M 2020 using namespace std; int n,k,a[M][M]; long long sum[M][M]; long long Get_Sum(int x1,int y1,int x2,int y2) { ][y2]-sum[x2][y1-]+s…