E. Vladik and cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vladik was bored on his way home and decided to play the following game. He took n cards and put them in a row in front…
E. Vladik and cards 题目链接 http://codeforces.com/contest/743/problem/E 题面 Vladik was bored on his way home and decided to play the following game. He took n cards and put them in a row in front of himself. Every card has a positive integer number not e…
C. Vladik and fractions 题目链接 http://codeforces.com/contest/743/problem/C 题面 Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction as a sum of three distinct posit…
A. Vladik and flights 题目链接 http://codeforces.com/contest/743/problem/A 题面 Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is…
传送门 Description Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction   as a sum of three distinct positive fractions in form . Help Vladik with that, i.e for a g…
题目大意 给定一个序列an,序列中只有1~8的8个整数,让你选出一个子序列,满足下列两个要求 1.不同整数出现的次数相差小于等于1 2.子序列中整数分布是连续的,即子序列的整数必须是1,1,1....1,2,2,2.....2,2.......连续分布 做法: 那么我们可以二分不同整数出现的次数,假如说二分出现次数是L,那么可以证明有a个整数出现次数是L,有(8-a)个整数出现次数是L-1(同时不难证明L+1比L更优) 这样每个整数只有两种状态,要么选L个,要么选L-1个. 压缩决策s,s的第i…
题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <string> #include <stack> #include <cmath> #inc…
不想欠题了..... 多打打CF才知道自己智商不足啊... A. Vladik and flights 给你一个01串  相同之间随便飞 没有费用 不同的飞需要费用为  abs i-j 真是题意杀啊,,,实际上我们只考虑01转换的代价一定为1如果目的地和起点相同  费用为0 不相同  肯定为1  因为0旁边必然有1 #include <cstdio> #include <iostream> #include <algorithm> #include <vector…
D - Chloe and pleasant prizes 链接 http://codeforces.com/contest/743/problem/D 题面 Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponso…
B. Chloe and the sequence 题目链接 http://codeforces.com/contest/743/problem/B 题面 Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the ol…
http://codeforces.com/contest/754/problem/C C. Vladik and chat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Vladik discovered a new entertainment — coding bots for social netwo…
地址: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…
传送门 Description Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad. Let's consider the following algorithm of generating a…
D. Chloe and pleasant prizes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a…
A. Vladik and flights time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is…
C. Vladik and fractions time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n h…
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…
A. Vladik and flights time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is…
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 题意:有n个机场处于一直线上,可两两到达,每个机场只可能属于两家公司中的一家(用0,1表示),现在要从a机场到b机场,可任意次转机.若机场i与机场j从属同一公司,则费用为0,否则费用为1.问最小费用? 分析:题目看懂就行了,起点和终点相同答案就是0,否则就是1 B 题意:和Wannafly Union Goodbye 2016的B题十分类似,分治搞 C 题意:求x,y,z使得对于给定的n(1≤n≤10^4) 2/n=1/x+1/y+1/z成立 分析:数学 目标是把2/n裂成3项 2/n=1/…
给出n个数字 1-8之间 要求选出来一个子序列 使里面1-8的数字个数 极差<=1 并且相同数字必须相邻(112 可以但是121不行)求这个子序列的最长长度 一道状压dp 看不懂别人的dp思想..自己造了一个出来.. 首先枚举t 意义是 当前选取子序列 每个数字最少是多少 那么这个子序列中的数字个数为t t+1 dp[i][j]当前在i位 选取数字的情况压缩成j 枚举没选过的数字 用前缀和进行二分查找 从第i位开始 求出res使在满足i-res这个区间有t或者t+1的某数字 进行转移 更新dp[…
一场比较简单的div2 电脑出了点问题 所以在比赛中理论ac了ACD 除了爆int这种事情之外.. A 一个人想从a到b 移动的花费这么定义 如果初始点和到达点类型相同 就不花钱 反之花距离差的绝对值的钱 并且是直接移动 判断ab的类型 一样就输出0 反之1 因为如果不能直接零花费到b的话 就花1花费走到一个和b类型相同的点 然后零花费移动 B 给出一个串的增长规律 问经过n-1次操作后 k位是多少 规律是这样的 一开始只有1 进行一次操作 就把当前串复制一遍粘在后面 然后在这两个相同串之间插入…
这场CF水题都非常的水,D题如果对树.DFS相关比较熟练的话也不难.比赛时前三题很快就过了,可是因为毕竟经验还是太少,D题就卡住了.比赛之后A题还因为没理解对题意fst了--(为什么这次就没人来hack我orz).唉,本来发挥好一些这次上蓝名是很有可能的,只能等待下一次了.Z神这次顺利AK,差距还是太大,虽然有初学为理由,但这个烤漆之后就会到来的假期还是要好好加油了,要学要练的东西实在是太多了. A题: 如果起点和终点是一家航空公司,那么显然0元就可到达.如果不是,0和1一定有一个分界处,先做起…
那个人第一步肯定要么能向下走,要么能向右走.于是一定可以判断出上下是否对调,或者左右是否对调. 然后他往这个方向再走一走就能发现一定可以再往旁边走,此时就可以判断出另一个方向是否对调. 都判断出来以后,跑个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…
C. Soldier and Cards Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/546/problem/C Description Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are diff…
链接:https://codeforces.com/contest/1173/problem/C 题意: Nauuo is a girl who loves playing cards. One day she was playing cards but found that the cards were mixed with some empty ones. There are nn cards numbered from 11 to nn, and they were mixed with…
题目链接:http://codeforces.com/problemset/problem/546/C 题解: 用两个队列模拟过程就可以了. 特殊的地方是:1.如果等大,那么两张牌都丢弃 : 2.如果操作了很多次仍不能分出胜负,则认为平手.(至于多少次,我也不知道,只能写大一点碰运气,但要防止超时) 代码如下: #include<iostream>//C - Soldier and Cards #include<cstdio> #include<cstring> #in…
E. George and Cards   George is a cat, so he loves playing very much. Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had distinct numbers written on them. Let's number the cards from the left to the…