
Codeforce
文章平均质量分 74
_Wilbert
这个作者很懒,什么都没留下…
展开
-
Codeforces-632D Longest Subsequence
You are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM as l. Find any longest subsequence o原创 2016-03-24 12:37:02 · 741 阅读 · 0 评论 -
Codeforces-703D Mishka and Interesting sum
题目大意:给你m个区间[l, r],让你计算区间[l, r]中出现偶数次的数的异或和解题思路:异或的性质比较明显 a ^ a = 0也就是说如果让你计算奇数次的异或和这就是裸题直接搞就行。但是是偶数的话,我们的想法其实很简单,对于[l, r]区间内出现的数,都再多异或一次比如1 2 1 3 3对于这个序列,计算偶数次可以1 ^ 2 ^ 1 ^ 3 ^ 3 ^ 1 ^ 2 ^原创 2016-08-05 22:38:56 · 652 阅读 · 0 评论 -
Codeforces-710E Generate a String
题目大意:有三个操作,插入删除和复制。其中插入和删除均耗费x时间来插入或删除一个字符,复制耗费y时间将当前文件内所有字符复制并粘贴(就是字符*2),现在需要生成n个字符,问你最少需要的时间。解题思路:DPdp[i]表示生成i个字符需要的最少时间,那么状态转移方程就是dp[i] = min(dp[i-1] + x, dp[i+1] + x, dp[i / 2] + y);代码原创 2016-08-23 13:06:44 · 888 阅读 · 0 评论 -
Codeforces-698A Vacations
Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was原创 2016-07-20 14:55:07 · 622 阅读 · 0 评论 -
Codeforces-687C The Values You Can Make
Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k原创 2016-07-01 13:07:21 · 1460 阅读 · 0 评论 -
Codeforces-706D Vasiliy's Multiset
题目大意:最开始的时候有一个集合,集合里面只有一个元素0,现在有q次操作,操作分为3种:+ x: 表示向集合中添加一个元素x- x:表示删除集合中值为x的一个元素? x:表示查询集合中与x异或的最大值为多少解题思路:乱搞。可以用一个multiset来维护这个集合。这样前两个操作就是非常简单的了,关键在于最后一个操作。对于异或来说,比如说如果给你一个数11,另外一个数原创 2016-08-12 15:04:43 · 945 阅读 · 0 评论 -
Codeforces-713C Sonya and Problem Wihtout a Legend
题目大意:给你一个序列,让你把它变成一个严格递增的序列。对每个数字,无论+1或者-1都消耗1,问你把它变成严格递增的序列的最小cost解题思路:DP首先根据题目,a[i+1] >= a[i] + 1,两边同时减去i+1,就得到a[i+1] - (i + 1) >= a[i] - i设b[i] = a[i] - i,则b序列是不降序列,那么问题就变成了将序列变成一个不降序列所原创 2016-10-10 21:05:20 · 499 阅读 · 0 评论 -
Codeforces-713A Sonya and Queries
题目大意:+ x表示向一个mutiset里增加一个数x- x表示向一个mutiset里面减少一个数x? x表示询问这个mutiset里面能够与x匹配的数的个数,匹配规则是x只由01组成,0表示偶数,1表示奇数。当x比要匹配的数长度短的时候,在x前面补0,当x比要匹配的数长度长的时候,在待匹配的数前面补0解题思路:乍一看觉得应该用字典树写。其实不然。直接设一个长度为2^18的原创 2016-10-10 20:52:40 · 557 阅读 · 0 评论 -
Goodbye 2016
2016最后一个小时。先把昨晚的Codeforces Goodbye 2016题解xjb写一下吧。第一题是水题。只要能看到题目应该能很快写掉。第二题有点意思。不过依旧是水题。可能有点坑点。在北极只有一个方向就是南,在南极只有一个方向就是北。不存在在南极或北极能向东向西这样的情况。如果从当前点向南向北走超过使得超过南极或北极,也是不合法的,因为在北极会有向北的方向,在南极有向南的方向。然原创 2016-12-31 23:59:28 · 982 阅读 · 3 评论 -
Codeforces-703B Mishka and trip
题目大意:给你n个点,标号为1-n,并且相邻的两个点之间存在路径,其路径权值为路径两端点权值的乘积,现在在1-n中有k个点,这k个点对其它任意一点都需要存在路径,但是两个点之间的路径不能超过一条。也就是没有重边,现在问你整个图的路径权值之和是多少解题思路:因为这题的数据为10w所以不可能用两两之间路径来枚举,那么有个简单的思路就是只需要知道与i点相连的路径权值之和就可以了。而对于k原创 2016-08-05 22:33:45 · 557 阅读 · 0 评论 -
Codeforces-698B Fix a Tree
A tree is an undirected connected graph without cycles.Let's consider a rooted undirected tree with n vertices, numbered 1 through n. There are many ways to represent such a tree. One way is to原创 2016-07-20 14:59:24 · 505 阅读 · 0 评论 -
Codeforces-688A Opponents
Arya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that guarantees they will win, but implementing this pla原创 2016-07-01 12:24:37 · 668 阅读 · 0 评论 -
Codeforces-688B Lovely Palindromes
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 ar原创 2016-07-01 12:27:21 · 621 阅读 · 0 评论 -
Codeforces-687A NP-Hard Problem
Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.Suppose the graph G is given. Subset A of its vertices is called原创 2016-07-01 12:30:55 · 1263 阅读 · 0 评论 -
Codeforces-687B Remainders Game
Today Pari and Arya are playing a game called Remainders.Pari chooses two positive integer x and k, and tells Arya k but not x. Arya have to find the value . There are n ancient numbers c1,原创 2016-07-01 12:40:40 · 792 阅读 · 0 评论 -
Codeforces-697C Lorenzo Von Matterhorn
Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road betwe原创 2016-07-15 13:05:33 · 1645 阅读 · 0 评论 -
Codeforces-697B Barnicle
Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate.Barney原创 2016-07-15 13:19:04 · 1004 阅读 · 0 评论 -
Codeforces-696B Puzzles
Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it原创 2016-07-17 13:46:07 · 1053 阅读 · 0 评论 -
Codeforces-699A Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and原创 2016-07-20 14:40:47 · 602 阅读 · 0 评论 -
Codeforces-699B One Bomb
You are given a description of a depot. It is a rectangular checkered field of n × m size. Each cell in a field can be empty (".") or it can be occupied by a wall ("*").You have one bomb. If you原创 2016-07-20 14:45:59 · 462 阅读 · 0 评论 -
Codeforces-620d Professor GukiZ and Two Arrays
题目大意:给你两个数组,一个长度为n,一个长度为m,第一个数组各个元素的和为suma,第二个数组各个元素的和为sumb,现在想要通过交换两个数组元素的方式使Abs(suma - sumb)最小,但是交换的次数不能超过两次。让你输出Abs(suma - sumb)的最小值,并输出这个值发生的时候的交换次数和交换元素在两个数组中的下标。解题思路:首先看到这题我们需要明确一下数据大小原创 2017-08-27 22:48:53 · 648 阅读 · 0 评论