E. XOR and Favorite Number 题目连接: http://www.codeforces.com/contest/617/problem/E Descriptionww.co 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 n…
题目链接:http://codeforces.com/problemset/problem/242/E 给你n个数,m个操作,操作1是查询l到r之间的和,操作2是将l到r之间的每个数xor与x. 这题是线段树成段更新,但是不能直接更新,不然只能一个数一个数更新.这样只能把每个数存到一个数组中,长度大概是20吧,然后模拟二进制的位操作.仔细一点就行了. #include <iostream> #include <cstdio> #include <cmath> #incl…
任意门:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks yo…
题目链接:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks y…
A. Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Two players play a game. Initially there are nn integers a1,a2,…,ana1,a2,…,an written on the board. Each turn a player selects one n…
题意:定义,对于a数组的一个子区间[l,r],f[l,r]定义为对该子区间执行f操作的值.显然,有f[l,r]=f[l,r-1] xor f[l+1,r].又定义ans[l,r]为满足l<=i<=j<=r的f[i,j]的最大值.多次询问你某些区间的ans值. ans=max(f[l,r],ans[l,r-1],ans[l+1,r]),直接递推即可. #include<cstdio> #include<algorithm> using namespace std;…
B. Minesweeper time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games.…
C. Finite or not? time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given several queries. Each query consists of three integers p , q and b. You need to answer whether the result of…
题目链接:http://codeforces.com/contest/984 A. Game time limit per test:2 seconds memory limit per test:512 megabytes input:standard input output:standard output Two players play a game. Initially there are nn integers a1,a2,…,ana1,a2,…,an written on the…
来自FallDream的博客,未经允许,请勿转载,谢谢. 为了证明一下我又来更新了,写一篇简要的题解吧. 这场比赛好像有点神奇,E题莫名是道原题,导致有很多选手直接过掉了(Claris 表演24s过题).然而D题比E题要难一些,分还少. A. Finite or not? 先把\(\frac{p}{q}\)约成最简分数,然后就是要判断是否\(q\)的所有质因数都是\(b\)的质因数. 每次取\(g=gcd(b,q)\),并尽可能的让\(q\)除\(g\),最后判断\(q\)是否是1即可. 还有一…