CodeForces
文章平均质量分 80
会打架的程序员不是好客服
略略略~~~
展开
-
Codeforces 545D - Queue (水题)
D. Queuetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle girl Susie went shopping with her mom and sh原创 2017-08-17 19:20:16 · 306 阅读 · 0 评论 -
Codeforces-891B Gluttony 思维题
891B Gluttony题意: 给出了一个序列a,a中所有的元素都不同。现在要求一个序列b(a序列重排构成的b),令b中任取k个数(1题解:任取k个数,让k个数的和与原来都不一样,因为只要求出一个这样的序列就可以了。所以可以想,如果让b序列中的所有元素都小于原来a序列中的数,那么随便怎么取都会保证b序列中任意k个数和a中不同。但是,这样取a中最小的数没有数与之对应,那么我们将a中原创 2018-01-17 17:38:09 · 230 阅读 · 0 评论 -
Codeforces 888E - Maximum Subsequence 折半枚举
888E - Maximum Subsequence题意:给出了N个数和M,要在N个数中任意找出k个数,令这k个数的和mod M的值最大。(N分析:用到了 meet-in-the-middle 的思想,能极大的优化 DFS 的暴力。数字的个数N最大只有35。但是直接暴力需要2^35显然不可以,我们可以分别暴力左右n/2个数,丢到两个set中,遍历第一个set,再原创 2018-01-15 21:37:07 · 219 阅读 · 0 评论 -
Codeforces Round #444 (Div. 2) D 尺取区间
There are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot mo原创 2018-01-15 15:10:42 · 267 阅读 · 0 评论 -
DFS序详解 Codeforces Round #442 E
DFS序给定一棵n个节点的树,m次查询,每次查询需要求出某个节点深度为h的所有子节点。 对于这个问题如果试图去对每个节点保存所有深度的子节点,在数据大的时候内存会吃不消;或者每次查询的时候去遍历一遍,当数据大的时候,时间效率会非常低。 此时如果使用dfs序维护树结构就可以轻松地解决这个问题。 作为预处理,首先将将树的所有节点按深度保存起来,每个深度的所有节点用一个线性结构保存,每个深度的节点相原创 2017-12-08 16:06:48 · 320 阅读 · 0 评论 -
Codeforces 535D - Tavas and Malekas (KMP)
D. Tavas and Malekastime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTavas is a strange creature. Usually "原创 2017-08-22 17:36:55 · 493 阅读 · 0 评论 -
codeforces 680D D. Bear and Tower of Cubes(dfs+贪心)
Bear and Tower of Cubestime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputLimak is a little polar bear. H翻译 2017-08-17 19:22:58 · 344 阅读 · 0 评论 -
Codeforces839D Winter is here (数论:容斥原理)
D. Winter is heretime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWinter is here at the North and the White原创 2017-08-18 11:25:43 · 295 阅读 · 0 评论 -
Codeforces Round #415 (Div. 2) C. Do you want a date?
A. Do you want a date?转载 2017-05-25 18:53:17 · 212 阅读 · 0 评论 -
Codeforces Round #396 D (带权并查集)
Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of relations: synonymy (i. e. the two words mean the same) and antonymy (i. e. the two word转载 2017-07-02 20:09:00 · 195 阅读 · 0 评论 -
Codeforces Round #216_div2_D.Valera and Fools
这一题主要是DP还是好想的。。不过我只能推出模糊的DP方程。看了一下别人的解法。转载请注明出处http://blog.csdn.net/moedane开始说题。 传送门 http://codeforces.com/contest/369/problem/D题意 有一群笨蛋排成一行玩游戏,编号由1到n。他们每人有一把枪,规则是每一轮所有的仍然存活的笨蛋都朝编号最小的人开枪,但是他们不会笨到自己朝自转载 2017-08-03 16:36:18 · 198 阅读 · 0 评论 -
Removing Columns - CodeForces 496 C
C. Removing Columnstime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputYou are given an n × m rectangular原创 2017-08-16 20:07:35 · 292 阅读 · 0 评论 -
Codeforces Round #303 (Div. 2) C. Woodcutters 贪心
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situat原创 2017-08-16 20:21:46 · 328 阅读 · 0 评论 -
codeforces 680C Bear and Prime 100(数论)
C. Bear and Prime 100time limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputThis is an interactive problem. In原创 2017-08-16 20:33:15 · 286 阅读 · 0 评论 -
Codeforces 385C Bear and Prime Numbers(数论)
C. Bear and Prime Numberstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputRecently, the bear started studyi原创 2017-08-16 20:48:29 · 217 阅读 · 0 评论 -
Codeforces 496D Tennis Game(二分)
D. Tennis Gametime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputPetya and Gena love playing table tennis原创 2017-08-17 19:10:09 · 270 阅读 · 0 评论 -
Codeforces 894.D Ralph And His Tour in Binary Country (预处理、二分)
题目链接:894D题目意思: 给你一个树,边的连接方式是i与i/2连一条无向边,长度为l[i]。q个询问,每个询问给出一个点a和一个值H,求以a为起点到任意点为终点获得(happiness=H-路径长度)不为负数的所有happiness之和。 可以发现这个题目中所给出的树是一棵拍立非常整齐的二叉树(emmmmmm。。。类似于线段树的那种树形结构)某个节点k的左儿子是2*k,右儿原创 2018-01-20 15:18:49 · 243 阅读 · 0 评论