摘要:
该数据结构可以维护序列的前缀和 1. 单点修改,求区间和 #include <iostream> using namespace std; const int N=5e5+2; int n,tr[N]; int lowbit(int x){ return x&-x; } void add(int x 阅读全文
摘要:
并查集判断图上是否有环 #include <iostream> #include <algorithm> using namespace std; const int N=1e5+4; int fa[N]; int find(int x){ return x==fa[x]?x:fa[x]=find( 阅读全文
摘要:
题目 There are nn chests. The ii-th chest contains aiai coins. You need to open all nn chests in order from chest 11 to chest nn. There are two types of 阅读全文
摘要:
const int M=1e3; const int N=2e3; int c[N][N]; void init(){ int i,j; c[1][1]=1; for(i=0;i<=M;i++) c[i][0]=1; for(i=2;i<=M;i++) for(j=1;j<=i;j++) c[i][ 阅读全文