数学
天涯-沧海
acmer
展开
-
2017 西安区域赛 g Sum of xor sum
题意:求区间[l,r]所有子区间异或和 思路:对前缀异或和b[i],如果b[i]==1,那它前面的0位置x,[x+1,i]这段区间异或和必为1,b[i]==0同理,那只要再分别对前缀异或和的0,1分别在做一次前缀和就好了 Song Zha Zha has an 111-indexed array A . Li Zha Zha has QQQ queries . Each query has two integers LLL, RRR , asking Ran Zha Zha to do the..原创 2020-06-24 14:41:35 · 266 阅读 · 0 评论 -
Codeforces Round #641 (Div. 2) D. Orac and Medians
思路:如果数组存在k,且存在一个区间[i,i+2],至少有两个数大于等于k,那么必定有解,否则无解 简略证明如下: 1.如果存在这么一个区间,那么要么它都变成k,然后拓展把数组所有数都变成k,要么它都变成x,x>k,然后扩展到k旁边,在由k扩展,全部变成k,例如n=8,k=2,3 1 3 1 1 1 1 2,那么可以变成 3 3 3 3 3 3 3 2,然后变成 2 2 2 2 2 2 2 2 2.如果不存在,那么说明每个[i,i+2]区间最多只有一个数大于等于k,那么任何区间,大于等于k的数.原创 2020-05-14 02:11:24 · 174 阅读 · 0 评论 -
Distance
Description There are n points on a horizontal line, labelled with 1 through n from left to right. The distance between the i -th point and the (i+1)-th point is ai . For each integer k ranged...原创 2019-09-22 18:28:11 · 191 阅读 · 0 评论