A. Vladik and Courtesy time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. Afte…
地址:http://codeforces.com/contest/811/problem/D 题目: D. Vladik and Favorite Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. Vladik has favorite game, in…
B. Vladik and Complicated Book time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vladik had started reading a complicated book about algorithms containing n pages. To improve understanding o…
http://codeforces.com/contest/811/problem/C 题意: 给出一行序列,现在要选出一些区间来(不必全部选完),但是相同的数必须出现在同一个区间中,也就是说该数要么不选,选了就必须出现在同一个区间,最后累加区间不同的数的异或值. 思路: 先预处理,求出每个数的左位置和右位置. d[i]表示分析到第 i 位时的最大值. #include<iostream> #include<algorithm> #include<cstring> #i…
那个人第一步肯定要么能向下走,要么能向右走.于是一定可以判断出上下是否对调,或者左右是否对调. 然后他往这个方向再走一走就能发现一定可以再往旁边走,此时就可以判断出另一个方向是否对调. 都判断出来以后,跑个spfa或者bfs就行了. 细节较多……有一些边界情况需要处理.比如终点在第一行或者第一列的情况. #include<cstdio> #include<queue> #include<cstring> #include<algorithm> using n…
划分那个序列,没必要完全覆盖原序列.对于划分出来的每个序列,对于某个值v,要么全都在该序列,要么全都不在该序列.  一个序列的价值是所有不同的值的异或和.整个的价值是所有划分出来的序列的价值之和.    求整个的价值的最大值   f(i)表示最后一个划分序列的右端点为i时,1~i的答案. f(i)=max{max{f(j)}(1<=j<i)+xorsum(j+1,i)(j+1到i的区间合法)}(1<=i<=n) 需要在转移的时候,顺便处理f(i)的前缀max. 最终的答案就是所有f…
Codeforces Round #521 (Div. 3)  E. Thematic Contests 题目传送门 题意: 现在有n个题目,每种题目有自己的类型要举办一次考试,考试的原则是每天只有一种题目类型一种题目类型只能出现在一天每天的题目类型不能相同,而且后一天的题目数量必须正好为前一天的两倍,第一天的题目数量是任意的求怎么安排能使题目尽量多.注意:不是天数尽量多 思路: 首先我们知道一件事,题目属于哪种类型并不重要,重要的是每种类型的个数所以我们先统计出所有类型的个数,存进一个数组,而…
A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. Afte…
A. Vladik and Courtesy 题面 At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for same…
A. Vladik and Courtesy 2 seconds 256 megabytes   At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less gen…