随笔分类 -  Codeforce

1
摘要:题目大意:给你两个数组,一个长度为n,一个长度为m,第一个数组各个元素的和为suma,第二个数组各个元素的和为sumb,现在想要通过交换两个数组元素的方式使Abs(suma - sumb)最小,但是交换的次数不能超过两次。让你输出Abs(suma - sumb)的最小值,并输出这个值发生的时候的交换... 阅读全文
posted @ 2017-08-27 22:49 _Wilbert 阅读(170) 评论(0) 推荐(0)
摘要:2016最后一个小时。先把昨晚的Codeforces Goodbye 2016题解xjb写一下吧。第一题是水题。只要能看到题目应该能很快写掉。第二题有点意思。不过依旧是水题。可能有点坑点。在北极只有一个方向就是南,在南极只有一个方向就是北。不存在在南极或北极能向东向西这样的情况。如果从当前点向南向北... 阅读全文
posted @ 2016-12-31 23:59 _Wilbert 阅读(225) 评论(0) 推荐(0)
摘要:题目大意:给你一个序列,让你把它变成一个严格递增的序列。对每个数字,无论+1或者-1都消耗1,问你把它变成严格递增的序列的最小cost解题思路:DP首先根据题目,a[i+1] >= a[i] + 1,两边同时减去i+1,就得到a[i+1] - (i + 1) >= a[i] - i设b[i] = a... 阅读全文
posted @ 2016-10-10 21:05 _Wilbert 阅读(299) 评论(0) 推荐(0)
摘要:题目大意:+ x表示向一个mutiset里增加一个数x- x表示向一个mutiset里面减少一个数x? x表示询问这个mutiset里面能够与x匹配的数的个数,匹配规则是x只由01组成,0表示偶数,1表示奇数。当x比要匹配的数长度短的时候,在x前面补0,当x比要匹配的数长度长的时候,在待匹配的数前面... 阅读全文
posted @ 2016-10-10 20:53 _Wilbert 阅读(153) 评论(0) 推荐(0)
摘要:题目大意:最开始的时候有一个集合,集合里面只有一个元素0,现在有q次操作,操作分为3种:+ x: 表示向集合中添加一个元素x- x:表示删除集合中值为x的一个元素? x:表示查询集合中与x异或的最大值为多少解题思路:乱搞。可以用一个multiset来维护这个集合。这样前两个操作就是非常简单的了,关键... 阅读全文
posted @ 2016-08-12 15:05 _Wilbert 阅读(103) 评论(0) 推荐(0)
摘要:题目大意:给你m个区间[l, r],让你计算区间[l, r]中出现偶数次的数的异或和解题思路:异或的性质比较明显 a ^ a = 0也就是说如果让你计算奇数次的异或和这就是裸题直接搞就行。但是是偶数的话,我们的想法其实很简单,对于[l, r]区间内出现的数,都再多异或一次比如1 2 1 3 3对于这... 阅读全文
posted @ 2016-08-05 22:39 _Wilbert 阅读(102) 评论(0) 推荐(0)
摘要:题目大意:给你n个点,标号为1-n,并且相邻的两个点之间存在路径,其路径权值为路径两端点权值的乘积,现在在1-n中有k个点,这k个点对其它任意一点都需要存在路径,但是两个点之间的路径不能超过一条。也就是没有重边,现在问你整个图的路径权值之和是多少解题思路:因为这题的数据为10w所以不可能用两两之间路... 阅读全文
posted @ 2016-08-05 22:34 _Wilbert 阅读(127) 评论(0) 推荐(0)
摘要: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 w... 阅读全文
posted @ 2016-07-20 14:59 _Wilbert 阅读(129) 评论(0) 推荐(0)
摘要: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: w... 阅读全文
posted @ 2016-07-20 14:55 _Wilbert 阅读(289) 评论(0) 推荐(0)
摘要: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 occupi... 阅读全文
posted @ 2016-07-20 14:46 _Wilbert 阅读(169) 评论(0) 推荐(0)
摘要: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.... 阅读全文
posted @ 2016-07-20 14:41 _Wilbert 阅读(163) 评论(0) 推荐(0)
摘要: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 U... 阅读全文
posted @ 2016-07-17 13:46 _Wilbert 阅读(126) 评论(0) 推荐(0)
摘要: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 an... 阅读全文
posted @ 2016-07-15 13:19 _Wilbert 阅读(228) 评论(0) 推荐(0)
摘要:Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road betwe... 阅读全文
posted @ 2016-07-15 13:06 _Wilbert 阅读(152) 评论(0) 推荐(0)
摘要: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 t... 阅读全文
posted @ 2016-07-01 13:07 _Wilbert 阅读(201) 评论(0) 推荐(0)
摘要: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 ... 阅读全文
posted @ 2016-07-01 12:41 _Wilbert 阅读(181) 评论(0) 推荐(0)
摘要: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 ... 阅读全文
posted @ 2016-07-01 12:31 _Wilbert 阅读(150) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2016-07-01 12:27 _Wilbert 阅读(165) 评论(0) 推荐(0)
摘要: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 gua... 阅读全文
posted @ 2016-07-01 12:25 _Wilbert 阅读(176) 评论(0) 推荐(0)
摘要: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. D... 阅读全文
posted @ 2016-03-24 12:37 _Wilbert 阅读(176) 评论(0) 推荐(0)

1