01 2017 档案
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 const int N=510000; 10 struct Tri 11 { 12 int Next[N][26], fail[N], v...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int Mod=1000000007;//10^9+7 7 char s[10000]; 8 int Hash(int l,int r) { 9 return Pre[r]-Pre[l-1]*Pow[r-l...
阅读全文
摘要:LGTB 最近在学分块,但是他太菜了,分的块数量太多他就混乱了,所以只能分成 3 块 今天他得到了一个数组,他突然也想把它分块,他想知道,把这个数组分成 3 块,块可以为空。假设 3 块各自的和中的最大值最小 请输出分完之后 3 块中的最大值 先枚举两个区间,然后对其中较大的一个区间进行二分,二分后
阅读全文
摘要:从前有一座岛屿,这座岛屿是一个长方形,被划为N*M的方格区域,每个区域都有一个确定的高度。不幸的是海平面开始上涨,在第i年,海平面的高度为t[i]。如果一个区域的高度小于等于海平面高度,则视为被淹没。那些没有被淹没的连通的区域够成一个连通块。现在问第i年,这样的连通块有多少个。 例如:第一年海平面高
阅读全文
摘要:1 #include 2 #include 3 #include 4 #define maxn 30010 5 #define S 16 6 7 using namespace std; 8 int n,m,num,head[maxn],fa[maxn][S+5],deep[maxn],p1,p2,ans; 9 struct node{ 10 int from...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct node 7 { 8 int left,right,flag; 9 long long sum; 10 }tree[600000]; 11 12 int n; 13 int a[200001]...
阅读全文
摘要:1 // Persistant segment tree 2 struct Node { 3 int val; 4 Node *ch[2]; 5 }; 6 7 int a[maxn], n; 8 Node *root[maxn]; 9 10 Node* sgtIns(Node* q, int pos) { // 在q的基础上将pos这个位置的数+1,...
阅读全文
摘要:1 #include 2 #include 3 4 using namespace std; 5 6 const int maxn = 1000003; 7 8 int n, m, father[maxn], op[maxn], ans[maxn], size[maxn]; 9 10 int findRoot(int x) { 11 int p, q...
阅读全文
摘要:转自:优先队列原理与实现 优先队列是一种用来维护一组元素构成的结合S的数据结构,其中每个元素都有一个关键字key,元素之间的比较都是通过key来比较的。优先队列包括最大优先队列和最小优先队列,优先队列的应用比较广泛,比如作业系统中的调度程序,当一个作业完成后,需要在所有等待调度的作业中选择一个优先级
阅读全文
摘要:给你一组数,a1,a2,a3,⋯,an。 令:G=gcd(a1,a2,a3,⋯,an) 现在从中任意删除一些数字,设剩下的数为:al1,al2,al3,⋯,alm。 再令:g=gcd(al1,al2,al3,⋯,alm) 现要求G=g,问最多能删除多少数?
阅读全文
摘要:选拔(select) Time Limit:2000ms Memory Limit:128MB 题目描述 LYK对n个女生有好感。第i个女生的身高为ai。 LYK要在这些女生中选拔出一个女生来作为他的女朋友。选拔当然要排队咯。于是LYK想让这n个女生排成一行。 但LYK觉得对于两个身高相同的女生,谁
阅读全文

浙公网安备 33010602011771号