Useful Links
YuanTiJi: http://yuantiji.ac/zh/
Pait: https://excalidraw.com/
WQOJ-UltraProMax: https://hydro.ac/d/wqoj/?notification=%E6%AC%A2%E8%BF%8E
Trick
https://www.luogu.com.cn/discuss/739182
P1344 [USACO4.4] 追查坏牛奶 Pollutant Control
stO 李: https://www.luogu.com/article/z1n5dpat
Study
STRING: https://www.cnblogs.com/alex-wei/p/Basic_String_Theory.html
FHQ: https://writings.sh/post/fhq-treap
sa: https://www.luogu.com.cn/article/26jvh6ij
杜教筛: https://www.cnblogs.com/peng-ym/p/9446555.html
高维前缀和:https://zhuanlan.zhihu.com/p/651143987
STL/CPP/Linux/Py/Shell
#pragma GCC optimize(3,"Ofast","inline")
tuple<int,int,int>
ulimit -v [memory, KiB as unit]
diff xxx.out xxx.out -Bb
std::mt19937_64 rd(std::chrono::steady_clock::now().time_since_epoch().count());
-fsanitize=address,undefined
bitset<N>b
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
cc_hash_table<>
gp_hash_table<>check.sh
#!/bin/bash
g++ d.cpp -o a -Wall
g++ data.cpp -o data -Wall
g++ ac.cpp -o brute_force -Wall
while true;do
./data>data.in
./a<data.in>d.out
./brute_force<data.in>ac.out
if cmp d.out ac.out;then
echo "AC!"
else
echo ":::WA!:::"
break
fi
donedata.py 生成有向有环图
from cyaron import *
import random
import os
n,m=9,10
graph = Graph.DAG(n, m, loop=True)
io = IO(file_prefix="data", data_id=1)
io.input_writeln(str(n)+" "+str(m))
io.input_writeln(graph.to_str(output=Edge.unweighted_edge))
q=100000
io.input_writeln(q)
for i in range(q):
io.input_writeln(str(random.randrange(1,n,1))+" "+str(random.randrange(1,n,1)))test.cpp 测速
#pragma GCC optimize(0)
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<fstream>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<vector>
#define ll long long
#define lf double
#define ld long double
using namespace std;
ll tot,tot2,st;
int main(){
for(int i=0;i<3;i++){
tot=0;
st=clock();
for(int i=0;i<100000000;i++)tot++;
tot=100000000/((clock()-st)*1.0/CLOCKS_PER_SEC);
cout<<tot<<' ';
tot2+=tot;
}
cout<<tot2/3;
return 0;
}求组合数的雀圣辕
void __INIT__(int n);
#include<bits/stdc++.h>
#define reg register
#define rep(i,a,b) for(reg int i=a;i<=b;i++)
#define drep(i,a,b) for(reg int i=a;i>=b;i--)
#define ll long long
using namespace std;
const int N=2000003,mod=998244353;
ll fac[N+50],inv[N+50];
ll qpow(ll a,ll b){ll ans=1,tmp=a;while(b){if(b&1)ans=ans*tmp%mod;tmp=tmp*tmp%mod;b>>=1;}return ans;}
ll C(ll n,ll m){ return fac[n]*inv[m]%mod*inv[n-m]%mod;}
ll lucas(ll n,ll m){
if(n<mod&&m<mod){
if(n<m)return 0;
return C(n,m);
}
return lucas(n/mod,m/mod)*lucas(n%mod,m%mod)%mod;
}
signed main(){
__INIT__(2000002);
return 0;
}
void __INIT__(int n){
fac[1]=1,fac[0]=1;
rep(i,2,n)fac[i]=(i*fac[i-1])%mod;
ll res=inv[n]=qpow(fac[n],mod-2);
drep(i,n-1,0)inv[i]=((res*=(i+1))%=mod);
inv[0]=1;
return void();
}Rd
sqrtl, ceil, 1ll
(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)(1ll << k)
打 Codeforces 多组数据用 memset。
不知道优先级就多打括号
幂次/根号运算时 中途溢出要做判断的情况
溢出用龟速乘
线段树开 4 倍
主席树空间单点增 log n
分块修改好快
对于这种删除点、边的题目,可以考虑使用线段树分治。
博弈题可考虑把先后手看成状态
染色思想???
所以二进制的题你为什么不想拆二进制位???
删边 -》 离线 , 加边
dp 是需要发现相互独立的子问题的
树状数组是可以维护后缀信息的
异型最短路要考虑流
度数*深度最优 log 最劣是 n
函数返回值
矩阵乘法用 operator, += 可以多线程,unsigned 取膜好快,常数优化
不是板子的数据结构还有奇怪的约束条件一般都会有神秘做法