基础莫队
bootdubbo
这个作者很懒,什么都没留下…
展开
-
SPOJ - DQUERY D-query
Given a sequence of n numbers a1, a2, …, an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct elements in the su...原创 2019-08-02 19:12:30 · 141 阅读 · 0 评论 -
HDU - 6278 Just $h$-index 【主席树】【二分+树状数组+莫队】
The h-index of an author is the largest h where he has at least h papers with citations not less than h.Bobo has published n papers with citations a1,a2,…,an respectively.One day, he raises q questi...原创 2019-08-03 16:42:51 · 164 阅读 · 0 评论 -
P4462 [CQOI2018]异或序列 【莫队】
题意:输入三个正整数n,m,k,n个数为a1,a2,a3…an,m次询问,求l~r区间内有多少对pair(x,y)使得 ax ^ ax+1 ^ ax+2 ^ ax+3 ^ … ^ ax+y == k思路:直接用莫队求解就好了,输入的l注意–一下,贼鸡儿简单#include<bits/stdc++.h>using namespace std;#define maxn 100001...原创 2019-09-10 15:35:15 · 134 阅读 · 0 评论 -
HDU - 6534 Chika and Friendly Pairs【树状数组+莫队】
Chika gives you an integer sequence a1,a2,…,an and m tasks. For each task, you need to answer the number of " friendly pairs" in a given interval.friendly pair: for two integers ai and aj, if i<j ...原创 2019-08-03 17:52:10 · 187 阅读 · 0 评论 -
HDU - 6278 Just $h$-index【二分+树状数组+莫队】
The h-index of an author is the largest h where he has at least h papers with citations not less than h.Bobo has published n papers with citations a1,a2,…,an respectively.One day, he raises q questi...原创 2019-08-03 16:20:55 · 155 阅读 · 0 评论 -
ZOJ 3289 Mato的文件管理【树状数组+莫队】
DescriptionMato同学从各路神犇以各种方式(你们懂的)收集了许多资料,这些资料一共有n份,每份有一个大小和一个编号。为了防止他人偷拷,这些资料都是加密过的,只能用Mato自己写的程序才能访问。Mato每天随机选一个区间[l,r],他今天就看编号在此区间内的这些资料。Mato有一个习惯,他总是从文件大小从小到大看资料。他先把要看的文件按编号顺序依次拷贝出来,再用他写的排序程序给文...原创 2019-08-03 11:45:29 · 139 阅读 · 0 评论 -
莫队详解(从入门到黑题)
https://www.cnblogs.com/WAMonster/p/10118934.html原创 2019-08-03 10:07:58 · 417 阅读 · 0 评论 -
CodeForces - 617E XOR and Favorite Number
Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the number of pairs of integers i and j, such that l ...原创 2019-08-03 09:49:50 · 115 阅读 · 0 评论 -
HYSBZ - 2038 小Z的袜子(hose)
作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。你的任务便是告诉小Z,他有多大的概率抽到两只颜色相同的...原创 2019-08-02 22:24:43 · 111 阅读 · 0 评论 -
P2709 小B的询问
题目描述小B有一个序列,包含N个1~K之间的整数。他一共有M个询问,每个询问给定一个区间[L…R],求Sigma(c(i)^2)的值,其中i的值从1到K,其中c(i)表示数字i在[L…R]中的重复次数。小B请你帮助他回答询问。输入格式第一行,三个整数N、M、K。第二行,N个整数,表示小B的序列。接下来的M行,每行两个整数L、R。输出格式M行,每行一个整数,其中第i行的整数表示第i个询...原创 2019-09-11 17:04:57 · 76 阅读 · 0 评论