分块,莫队(学习、题)
桃社长
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Color the ball(分块1)————分块(模板题+学习)
/*************分 块 将 n 个数 分为多个块 , 便于区间修改 和查找如果 元素总个数 为 n①每个块中元素的个数,用block表示 block = (int)sqrt(n); (注意 表示的 是每块的元素个数)②块的个数,用num表示: num = n/block; if(n%block!= 0)num++; //整除不了要多加一块 ...原创 2019-08-02 00:21:51 · 1364 阅读 · 0 评论 -
B - Argestes and Sequence(分块2)————分块
/************* 该题 要用快速幂 算10的x次方 快速 砍位 ********************/#include<cstdio>#include<cstring>#include<cstdlib>#include<iostream>#include<cmath>using namespace st...原创 2019-07-30 17:18:41 · 191 阅读 · 0 评论 -
C - Super Mario(分块3)————分块
/******分块+二分***********/#include <iostream>#include<cstdio>#include<cstring>#include<cmath>#include<map>#include<algorithm>using namespace std;const int ...原创 2019-07-30 20:36:24 · 155 阅读 · 0 评论 -
R21908829————莫队(入门题)
统计[l,r]区间内不同数的个数https://www.luogu.org/problem/SP3267#include<bits/stdc++.h>using namespace std;const int maxn = 2e6;int n, q;int cnt[1000000+10];int a[maxn];int pos[300];int res[2...原创 2019-07-31 21:35:09 · 155 阅读 · 0 评论 -
Group(莫队1) HDU4638————莫队(学习+题)
代码1:/***********莫队算法 思路 如果增加一个数 如果该数减1 和该数加1 都不存在 就表示他可以独立成组 组数就加一如果增加一个数 如果该数减1 和该数加1 都存在 就表示 两个组合并了(合并原因 是为了得到 题目中的值最大) 组数就减一 增加的其他情况 不改变组数 如果减少一个数 如果这个数左右都不存在 就表示这个组消失 组数减一 如...原创 2019-08-01 00:06:35 · 109 阅读 · 0 评论
分享