
codeforces
文章平均质量分 84
西湖醋瓜
计算机爱好者
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
codeforces Round #274(div2) A解题报告
A. Expressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya studies in a school and he adores Maths.原创 2014-10-20 11:54:32 · 830 阅读 · 0 评论 -
codeforces Round #264(div2) B解题报告
B. Caisa and Pylonstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCaisa solved the problem with the sugar原创 2014-10-15 21:53:36 · 687 阅读 · 0 评论 -
codeforces Round #272(div2) C解题报告
C. Dreamoon and Sumstime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon loves summing up something原创 2014-10-13 10:00:53 · 882 阅读 · 0 评论 -
codeforces Round #272(div2) B解题报告
B. Dreamoon and WiFitime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon is standing at the position 0原创 2014-10-13 09:50:39 · 765 阅读 · 0 评论 -
codeforces Round #272(div2) A解题报告
A. Dreamoon and Stairstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon wants to climb up a stair of原创 2014-10-13 09:43:37 · 677 阅读 · 0 评论 -
codeforces Round #272(div2) D解题报告
D. Dreamoon and Setstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon likes to play with sets, integ原创 2014-10-13 10:06:42 · 650 阅读 · 0 评论 -
codeforces Round #258(div2) B解题报告
B. Sort the Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBeing a programmer, you like arrays a lot.原创 2014-10-28 17:06:14 · 876 阅读 · 0 评论 -
codeforces Round #258(div2) C解题报告
题目大意: 有n场比赛,你错过了k场,然后再错过的k长中,一队与二队的胜利差值为d1,二队与三队的胜利差值为d2。如若有可能,三支队伍获胜次数都一样,则输出yes,否则输出no解法: 比较有趣且复杂的模拟题,我们可以想象成三个柱子,已知第一个柱子跟第二个柱子的高度差的绝对值,第二个柱子跟第三个柱子高度差的绝对值,现在还有n-k个砖(1高度),要求使得三个柱子高度一样。首先,给了d1和d2,我们可以枚举一下有那几种基本情况: 1. d1, 0, d2;原创 2014-10-28 17:18:12 · 1084 阅读 · 0 评论 -
codeforces Round #258(div2) A解题报告
A. Game With Stickstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter winning gold and silver in IOI 201原创 2014-10-28 17:01:03 · 834 阅读 · 0 评论 -
codeforces Round #258(div2) D解题报告
题目大意:给出一串字符,只含有a和b。现在定义一个字串如若合并之后的字串是个回文字符串,就是一个good substrings,求出这样的字串有多少个,并输出长度为偶数和奇数的个数。解法:首先,我们需要注意到两个已知条件: 1. 字串可以合并,例如 abbaabbb 合并之后就是abab 2. 只有两个字符a,b我们可以发现,合并之后的字串一定是aba或者abab类型的,那么合并之后的字串如果是回文的话,第一个字符肯定与最后一个字符相同,反之亦然。我们可以进一步原创 2014-10-28 17:28:09 · 997 阅读 · 3 评论 -
codeforces Round #275(div2) D解题报告
题目大意:假设有n个非负数,现在有m个限制,a[l] & a[l+1] & a[l+2] ... & a[r] = q。要求根据上述的限制,输出符合要求的1~n个数,如若不能则输出“NO”。解法: 我们先挖掘题意,弄清楚题目给的已知条件和要我们输出什么。 a[l] & a[l+1] & a[l+2] ... & a[r] = q,这是每个限制的基本形式,由“&”我们可以得知,如若q中的某一个bit是1的话,则要求a[l]~a[r]中的那个bit位都为1。这个条件看似是限制原创 2014-10-27 21:08:08 · 1250 阅读 · 0 评论 -
codeforces Round #275(div2) A解题报告
A. Counterexampletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend has recently learned about cop原创 2014-10-27 20:53:43 · 853 阅读 · 0 评论 -
codeforces Round #275(div2) C解题报告
C. Diverse Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPermutation p is an ordered set of in原创 2014-10-27 20:58:31 · 891 阅读 · 0 评论 -
codeforces Round #275(div2) B解题报告
B. Friends and Presentstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have two friends. You want to pr原创 2014-10-27 21:17:15 · 944 阅读 · 0 评论 -
codeforces Round #259(div2) B解题报告
题目大意:给出N个数字,可以每一次将最后一个数字移动到最前面,要求最终状态是一个单调非递减的序列,求最少需要花多少次操作。如若无法达到目标则输出“-1"。解法:也是一道很easy的编程基础题,找出两队单调非递减序列,分别为1~x 和 x+1~y,判断这两队是否覆盖整串数字,且a[n] <= a[1]。更简单的一种做法就是,将a[1]~a[n]复制一遍,拓展到a[1]~a[2*n],然后在1 ~ 2*n里面找,是否有一串单调不递减的个数为n的序列。原创 2014-10-24 19:11:17 · 1007 阅读 · 0 评论 -
codeforces Round #269(div2) D解题报告
D. MUH and Cube Wallstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolar bears Menshykov and Uslada from原创 2014-09-30 09:52:38 · 666 阅读 · 0 评论 -
codeforces Round #267(div2) B解题报告
B. Fedor and New Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter you had helped George and Alex t原创 2014-10-04 11:40:03 · 726 阅读 · 0 评论 -
codeforces Round #267(div2) C解题报告
C. George and Jobtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe new ITone 6 has been released recently原创 2014-10-04 11:46:53 · 1245 阅读 · 0 评论 -
codeforces Round #264(div2) C解题报告
C. Gargari and Bishopstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGargari is jealous that his friend C原创 2014-10-15 22:08:37 · 742 阅读 · 0 评论 -
codeforces Round #274(div2) D解题报告
这题,我们必然需要查询某个数,这里我们可以让ai单调(题目已经预设是单调的),然后采用二分来查询,这样,每次查询只需要O(logn)的时间复杂度,这是本题的基本的核心。由题意可知,标记增加量可能为:0, 1, 2;为0个的时候: 则x和y都可以在尺子上找到,即a[i]+x和a[i]+y均可在尺子上找到,我们可以采用二分搜索。复杂度为O(nlogn);为1个的时候: 第一种情况:x或y其中一个可以在尺子上找到; 第二种情况:可以找到组合点,即 a[i]+原创 2014-10-20 12:13:40 · 1182 阅读 · 2 评论 -
codeforces Round #274(div2) E解题报告
首先明确一点,如若a < b,则无论如何都不可能乘坐到大于b的那一部分,反之亦然。 采用动态规划策略,这里我们可以以i为乘坐了i次,j为哪一层电梯。f[i][j] = sum(f[i-1][m]) - f[i-1][j],这里的m为满足条件的上一个楼层(设上一个楼层为x |x-j| < |x-b| )。这里的时间复杂度为O(k*n*n); 我们可以发现,m为一段连续区间,我们就可以用sum先累积起来,这里就直接简化为O(1),总的时间复杂度为O(k*n)。(PS: 注意m的边界)原创 2014-10-20 12:22:42 · 876 阅读 · 2 评论 -
codeforces Round #274(div2) C解题报告
C. Examstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputStudent Valera is an undergraduate student at the U原创 2014-10-20 12:08:48 · 764 阅读 · 0 评论 -
codeforces Round #274(div2) B解题报告
B. Towerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, all the kids in Berland love playing原创 2014-10-20 11:57:19 · 849 阅读 · 0 评论 -
codeforces Round #273(div2) D解题报告
D. Red-Green Towerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are r red and g green blocks for原创 2014-10-18 21:28:17 · 743 阅读 · 0 评论 -
codeforces Round #273(div2) A解题报告
A. Initial Bettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are five people playing a game called "原创 2014-10-18 21:06:23 · 620 阅读 · 0 评论 -
codeforces Round #273(div2) C解题报告
C. Table Decorationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have r red, g green and b blue ba原创 2014-10-18 21:20:21 · 677 阅读 · 0 评论 -
codeforces Round #273(div2) B解题报告
B. Random Teamstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputn participants of the competition were split原创 2014-10-18 21:12:07 · 618 阅读 · 0 评论 -
codeforces Round #263(div2) C解题报告
C. Appleman and Toastmantime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAppleman and Toastman play a game.原创 2014-10-17 11:51:55 · 723 阅读 · 0 评论 -
codeforces Round #263(div2) E解题报告
E. Appleman and a Sheet of Papertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAppleman has a very big sh原创 2014-10-17 12:13:52 · 254 阅读 · 0 评论 -
codeforces Round #263(div2) B解题报告
B. Appleman and Card Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAppleman has n cards. Each card原创 2014-10-17 11:34:39 · 601 阅读 · 0 评论 -
codeforces Round #263(div2) A解题报告
A. Appleman and Easy Tasktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToastman came up with a very easy原创 2014-10-17 11:31:35 · 806 阅读 · 0 评论 -
codeforces Round #264(div2) A解题报告
A. Caisa and Sugartime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCaisa is going to have a party and he nee原创 2014-10-15 21:46:34 · 773 阅读 · 0 评论 -
codeforces Round #267(div2) A解题报告
A. George and Accommodationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGeorge has recently entered the原创 2014-10-04 11:23:04 · 683 阅读 · 0 评论 -
codeforces Round #264(div2) E解题报告
E. Caisa and Treetime limit per test10 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCaisa is now at home and his son has a s原创 2014-10-15 22:15:41 · 763 阅读 · 0 评论 -
codeforces Round #264(div2) D解题报告
D. Gargari and Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGargari got bored to play with原创 2014-10-15 22:14:04 · 687 阅读 · 0 评论 -
codeforces Round #259(div2) E解题报告
题目大意:给出一张图,有N个点,M条边,并给出每个点要求访问次数的奇偶性。,要求输出访问路径。解法:首先我们可以明确一点,这就是一个图的遍历,找一个点,设为起点,建立一个搜索遍历树,对于树每一个点,我们完全可以控制奇偶性,假设: 目前访问的点为v,父节点为fa,如若点v不符合当前的奇偶性,则就让父节点到v绕一次,这样 odd[v] ^= 1, fa[v] ^= 1,这样我们可以完全保证完全控制子节点,将不符合要求的奇偶性调整成符合要求的奇偶性。同时父节点的奇偶性也在改变。原创 2014-10-24 20:02:20 · 1022 阅读 · 0 评论 -
codeforces Round #269(div2) B解题报告
B. MUH and Important Thingstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's time polar bears Menshykov原创 2014-09-29 15:14:56 · 660 阅读 · 0 评论 -
codeforces Round #263(div2) D解题报告
很典型的树形dp了。第一步,明确问题的类型:计数型DP,并非最大值或最小值DP,考虑到其结构是一个树形,很容易联想到树形DP。第二步,划分阶段和状态:阶段为v,即为每个节点;状态为s,即为包括节点v以内的子树内有无黑节点,1表示有1个黑节点,0表示没有黑节点。第三步,由于是计数型DP,就得明确先明确计数原理:乘法原理与加法原理相结合。乘法原理:用于v节点的所有child节点中,整个v节点有多少种方案,需要通过所有child节点,如果标上顺序(结果与访问child顺序无关,所以怎样的合法顺序都原创 2014-10-17 12:04:44 · 715 阅读 · 0 评论 -
codeforces Round #238(div2) d解题报告
D. Toy Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Chris is very keen on his toy blocks. His原创 2014-03-27 21:20:49 · 796 阅读 · 0 评论 -
codeforces Round #238(div2) A解题报告
A. Gravity Fliptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Chris is bored during his physics les原创 2014-03-27 16:32:43 · 629 阅读 · 0 评论