上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: #include<bits/stdc++.h> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 typedef long long ll; const int maxn=1e6+10; ll tree[ma 阅读全文
posted @ 2021-08-06 00:24 _LH2000 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 找i节点的第k个父亲 int father(int i,int k) { for(int x=0;x<=int(log2(k));x++) if((1<<x)&k) //(1<<x)&k可以判断k的二进制表示中,第(x-1)位上是否为1 i=fa[i][x]; //把i往上提 return i; } 阅读全文
posted @ 2021-07-22 17:03 _LH2000 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 本质是带优化的双指针,对全部区间进行√n个块的分块操作,然后进行排序。第一关键字为查询的左端点块号,第二关键字为查询的右端点本身的位置。 这里放一个洛谷例题 P3901 数列找不同 附上代码 #pragma GCC optimize("O3") #include <bits/stdc++.h> #d 阅读全文
posted @ 2021-07-22 16:26 _LH2000 阅读(31) 评论(0) 推荐(0) 编辑
摘要: void rmq_init() { for(int i=1;i<=N;i++) dp[i][0]=arr[i];//初始化 for(int j=1;(1<<j)<=N;j++) for(int i=1;i+(1<<j)-1<=N;i++) dp[i][j]=min(dp[i][j-1],dp[i+( 阅读全文
posted @ 2021-07-22 14:24 _LH2000 阅读(23) 评论(0) 推荐(0) 编辑
摘要: '可以用到整除分块的形式,大致是这样的: 对于每一个 ⌊n/i⌋ 我们可以通过打表可以发现:有许多 ⌊n/i⌋ 的值是一样的,而且它们呈一个块状分布;再通过打表之类的各种方法,我们惊喜的发现对于每一个值相同的块,它的最后一个数就是n/(n/i)。 for(int l=1,r;l<=n;l=r+1) 阅读全文
posted @ 2021-07-20 12:34 _LH2000 阅读(40) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> #define reg register using namespace std; typedef long long ll; const int MN=60; ll a[61],tmp[61]; bool flag; void ins(ll x) { 阅读全文
posted @ 2021-07-12 16:50 _LH2000 阅读(36) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int mx=250501;//n*m+m<=250500 inline int Read(){ 阅读全文
posted @ 2021-07-07 17:27 _LH2000 阅读(68) 评论(0) 推荐(0) 编辑
摘要: //最小覆盖球 #include <iostream> #include <string.h> #include <stdio.h> #include <math.h> #define N 150 #define eps 1e-8 #define T 100 #define delta 0.98 # 阅读全文
posted @ 2021-07-06 16:19 _LH2000 阅读(46) 评论(0) 推荐(0) 编辑
摘要: //Suplex #include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #define N 100000 using namespace std; const in 阅读全文
posted @ 2021-05-31 20:12 _LH2000 阅读(54) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=10005; ll n,m,sum,tim,top,s; ll p[maxn],head[maxn],sd[maxn],dfn[maxn 阅读全文
posted @ 2021-05-28 21:29 _LH2000 阅读(44) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页