求异或maxmin一般用trie (二进制式的trie)。query中找的是满足((x>>i)&1)^A=1,那么A=((x>>i)&1)^1;maxx=max(sumx,sumi)(i=[1,x])。(YY一下异或的性质 4260: Codechef REBXOR Description Inpu ...
分类:
其他好文 时间:
2016-07-20 22:53:41
阅读次数:
206
Description You are given an array A consisting of N positive integers. You have to answer Q queries on it of following type: l r k : Let S denote the ...
分类:
编程语言 时间:
2016-07-14 01:24:44
阅读次数:
380
Description All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is a bi ...
分类:
其他好文 时间:
2016-07-13 20:26:52
阅读次数:
139
Description All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is the ...
分类:
其他好文 时间:
2016-07-13 19:46:01
阅读次数:
142
看到异或就去想前缀和(⊙o⊙) 这个就是正反做一遍最大异或和更新答案 最大异或就是很经典的可持久化Trie,从高到低贪心 WA: val&(1<<(base-1))得到的并不直接是1/0 1 #include<bits/stdc++.h> 2 #define ll long long 3 #defi ...
分类:
其他好文 时间:
2016-06-08 00:22:08
阅读次数:
312
题目链接:http://www.codechef.com/problems/PRIMEDST/ 题意:给出一棵树,边长度都是1。每次任意取出两个点(u,v),他们之间的长度为素数的概率为多大? 树分治,对于每个根出发记录边的长度出现几次,然后每次求卷积,用素数表查一下即可添加答案。 ...
分类:
其他好文 时间:
2016-05-26 20:35:24
阅读次数:
219
Description 给定一个初始时为空的整数序列(元素由1开始标号)以及一些询问: 类型1:在数组后面就加入数字x。 类型2:在区间L…R中找到y,最大化(x xor y)。 类型3:删除数组最后K个元素。 类型4:在区间L…R中,统计小于等于x的元素个数。 类型5:在区间L…R中,找到第k小的 ...
分类:
其他好文 时间:
2016-05-16 19:24:07
阅读次数:
226
Description
All submissions for this problem are available.
Problem description.
You are given a tree. If we select 2 distinct nodes uniformly at random, what's the probability that the distance ...
分类:
其他好文 时间:
2016-05-07 08:22:31
阅读次数:
227
Description 给定一个初始时为空的整数序列(元素由1开始标号)以及一些询问: 类型1:在数组后面就加入数字x。 类型2:在区间L…R中找到y,最大化(x xor y)。 类型3:删除数组最后K个元素。 类型4:在区间L…R中,统计小于等于x的元素个数。 类型5:在区间L…R中,找到第k小的 ...
分类:
其他好文 时间:
2016-04-23 21:29:01
阅读次数:
200