![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
莫队算法
kuronekonano
这个作者很懒,什么都没留下…
展开
-
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 ...原创 2018-03-22 03:38:43 · 255 阅读 · 0 评论 -
牛客网暑假训练第一场——J Different Integers(莫队算法 & 树状数组)
链接:https://www.nowcoder.com/acm/contest/139/J 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 Given a sequence of integers a1, a2, …, an and q pairs of in...原创 2018-07-22 22:02:52 · 184 阅读 · 0 评论 -
HDU-6301 Distinct Values(区间平移构造数组)
Problem Description Chiaki has an array of n positive integers. You are told some facts about the array: for every two elements ai and aj in the subarray al..r (l ≤ i < j ≤ r), ai≠aj holds. Chiak...原创 2018-08-05 21:03:19 · 183 阅读 · 0 评论 -
【2018黑龙江省赛】UPC-7218 A Sequence Game(莫队&离散化&RMQ ST表)
题目描述 One day, WNJXYK found a very hard problem on an Online Judge. This problem is so hard that he had been thinking about the solutions for a couple of days. And then he had a surprise that he misund...原创 2018-09-23 13:13:20 · 383 阅读 · 0 评论 -
Codeforces Round #136 B - Little Elephant and Array(莫队算法)
题意:给n个数,m次询问,每次询问给出一个区间,问区间内其值和出现次数相等的数有多少个。 简单莫队,注意在因为数字值大小给出的是1e9的,而我们要记录每个数的出现次数即要用数组标记,但是其实因为n的大小只有1e5,也就是说超过1e5的值都是不可能被记入答案的,忽略掉就好。并不用离散化。直接用莫队跑一边就好了。 #include&lt;bits/stdc++.h&gt; #define LL lo...原创 2018-11-01 19:11:57 · 303 阅读 · 0 评论