
莫队
YOONGI
这个作者很懒,什么都没留下…
展开
-
HYSBZ - 2038 [2009国家集训队]小Z的袜子(hose) (莫队)
小Z的袜子(hose) 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命…… 具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。 你的任务便是告诉小Z,...原创 2019-08-09 10:19:22 · 130 阅读 · 0 评论 -
LightOJ - 1188 Fast Queries (莫队)
Fast Queries Given an array ofNintegers indexed from1toN, andqqueries, each in the formi j, you have to find the number of distinct integers from indexitoj(inclusive). Input Input st...原创 2019-08-09 10:24:07 · 250 阅读 · 0 评论 -
SPOJ - DQUERY D-query (莫队)
D-query English Vietnamese Given a sequence of n numbers a1, a2, ..., anand 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...原创 2019-08-09 10:27:04 · 149 阅读 · 0 评论 -
CodeForces - 220B Little Elephant and Array (莫队+离散化)
Little Elephant and Array The Little Elephant loves playing with arrays. He has arraya, consisting ofnpositive integers, indexed from 1 ton. Let's denote the number with indexiasai. Additi...原创 2019-08-09 10:32:45 · 141 阅读 · 0 评论 -
NBUT - 1457 Sona (莫队+离散化)
Sona Sona,Maven of the Strings. Of cause, she can play the zither. Sonacan't speak but she can make fancy music. Her music can attack, heal, encourage and enchant. There're an ancientsc...原创 2019-08-09 10:59:04 · 286 阅读 · 0 评论 -
CodeForces - 86D Powerful array (莫队)
Powerful array An array of positive integersa1, a2, ..., anis given. Let us consider its arbitrary subarrayal, al + 1..., ar, where1 ≤ l ≤ r ≤ n. For every positive integersdenote byKsthe ...原创 2019-08-09 11:14:24 · 141 阅读 · 0 评论 -
UVA - 12345 Dynamic len(set(a[L:R])) (带修改莫队)
Dynamic len(set(a[L:R])) 题目链接:https://vjudge.net/problem/UVA-12345 题目大意:给出长度为n的数组,有m个操作 ,Q x y 表示查询 [x , y-1]区间里有多少种不同的数字, M x y 表示把 a[x] 修改为y 思路:带修改的莫队。在原来的莫队上,加了修改。其余不变,在查询 l,r,pos,中再加一个m,表示当...原创 2019-08-09 16:36:40 · 295 阅读 · 0 评论 -
CodeForces - 940F Machine Learning (带修改莫队+离散化)
Machine Learning You come home and fell some unpleasant smell. Where is it coming from? You are given an arraya. You have to answer the following queries: You are given two integerslandr. Le...原创 2019-08-10 10:18:22 · 850 阅读 · 0 评论 -
CodeForces - 617E XOR and Favorite Number (莫队)
XOR and Favorite Number Bob has a favorite numberkandaiof lengthn. Now he asks you to answermqueries. Each query is given by a pairliandriand asks you to count the number of pairs of in...原创 2019-08-10 11:56:51 · 127 阅读 · 0 评论