BZOJ
kkjy_00
这个作者很懒,什么都没留下…
展开
-
BZOJ4195 程序自动分析
离散化+并查集#include<cstdio>#include<algorithm>using namespace std;const int maxn = 1e6 + 5;int prt[maxn], a[maxn*2];struct node{ int x, y, op; bool operator < (const node &...原创 2019-02-14 17:50:51 · 91 阅读 · 0 评论 -
BZOJ3262 陌上花开
cdq分治三维偏序问题#include<bits/stdc++.h>using namespace std;const int maxn = 2e5 + 5;int ans[maxn], c[maxn];int tot, n, m;struct node{ int a, b, c, cnt, ans; } q[maxn], p[maxn], tmp[maxn];i...原创 2019-06-08 22:18:25 · 81 阅读 · 0 评论 -
BZOJ3224 Tyvj 1728 普通平衡树
您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除一个)3. 查询x数的排名(若有多个相同的数,因输出最小的排名)4. 查询排名为x的数5. 求x的前驱(前驱定义为小于x,且最大的数)6. 求x的后继(后继定义为大于x,且最小的数)#include<bits/stdc++.h>usin...原创 2019-06-02 22:21:54 · 72 阅读 · 0 评论 -
BZOJ1483 梦幻布丁
链表+启发式合并对于每次染色,就将两个颜色合并就行#include<bits/stdc++.h>using namespace std;const int maxn = 1e6 + 5;int head[maxn], Next[maxn], sum[maxn], col[maxn], now[maxn];int ans;inline int read(){ ...原创 2019-06-02 14:38:11 · 87 阅读 · 0 评论 -
BZOJ1053 反素数ant
#include<bits/stdc++.h>using namespace std;typedef long long ll;int p[] = {2,3,5,7,11,13,17,19,23,29,31};int n, ans;ll fac_num = 0;void dfs(int step,int num,ll x,int len){ if(step ==...原创 2019-01-21 17:05:14 · 159 阅读 · 0 评论 -
BZOJ4034 树上操作
树链剖分对于2操作 以x为根的所有子节点的区间为seg[x],seg[x]+siz[x]-1,该点在线段树的位置到该点位置+以该点为根的子节点个数,因为树链剖分时子节点与根的位置是相连的数据要用long long存#include<cstdio>#include<algorithm>using namespace std;typedef long lon...原创 2019-04-22 16:24:20 · 85 阅读 · 0 评论 -
BZOJ1036 树的统计Count
树链剖分模板题#include<cstdio>#include<algorithm>using namespace std;const int maxn = 3e4 + 5;struct node{ int l, r, maxx, sum; } tree[maxn*4] ;int ver[maxn*2], Next[maxn*2], head[maxn], ...原创 2019-04-22 16:19:52 · 82 阅读 · 0 评论 -
BZOJ1257 余数之和
一道数学题,要想到k/i有一段是相等的,区间为i到k/k/i#include<cstdio>#include<algorithm>using namespace std;typedef long long ll;int main(){ ll n, k, ans; scanf("%lld%lld",&n,&k); ans...原创 2019-01-24 21:28:08 · 168 阅读 · 0 评论 -
BZOJ3211 花神游历各国
线段树 将区间更新进行到叶子节点,标记值为0和1这样不需要更新的节点,节省时间Time 2160ms Memory 9032kB #include<cstdio>#include<cmath>using namespace std;const int maxn = 1e5 + 5;int num[maxn];struct node...原创 2019-02-01 21:49:41 · 84 阅读 · 0 评论 -
BZOJ1012 最大数maxnumber
线段树的题目Time 1152ms Memory 10196kB #include<cstdio>#include<algorithm>using namespace std;const int maxn = 2e5;const int inf = 0x3f3f3f3f;struct node{ int l, r, max...原创 2019-02-01 21:51:37 · 130 阅读 · 0 评论 -
BZOJ1218 激光炸弹
二维前缀和 #include<cstdio>#include<algorithm>using namespace std;int s[5005][5005];int main(){ int n, r, x, y, v, ans = 0; scanf("%d%d",&n,&r); for(int i = 1; i <...原创 2019-02-10 16:29:04 · 108 阅读 · 0 评论 -
BZOJ3629 聪明的燕姿
唯一分解定律+约数和定理搜索可能的质数,找出符合条件的答案注意:不存在时,不要多大一个换行#include<bits/stdc++.h>using namespace std;const int maxn = (1<<16)+5;int prime[maxn], v[maxn], ans[maxn];int m, cnt;void primes()...原创 2019-07-10 15:53:45 · 94 阅读 · 0 评论