
Codefoces
文章平均质量分 79
jerans
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #447 (Div. 2) B C 思维
好久没打cf。。感觉智商已经退化到了零点,随便找了一套div2补一补。。。。B题就卡住了http://codeforces.com/contest/894/problem/BB题意是给一个n*m的方格,往每个格子里填1或-1,有多少种填的方法使得每行每列乘积都等于k,k已知,-1或1n,m范围很大第一想法,推组合数??????感觉毫无头绪。。。纸上画画,发现当(n+m)原创 2017-12-12 21:52:47 · 325 阅读 · 0 评论 -
CodeForces - 612D The Union of k-Segments
D. The Union of k-Segmentstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n segments on the原创 2017-05-22 17:26:52 · 398 阅读 · 0 评论 -
Educational Codeforces Round 5 E. Sum of Remainders 思维 数学转换
E. Sum of Remainderstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCalculate the value of the sum: n mod原创 2017-06-02 10:05:47 · 359 阅读 · 0 评论 -
Codeforces Round #417 (Div. 2)Sagheer, the Hausmeister 乱搞 Sagheer and Nubian Market 二分
B. Sagheer, the Hausmeistertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSome people leave the lights at原创 2017-06-02 09:47:58 · 515 阅读 · 0 评论 -
Nested Segments CodeForces - 652D 树状数组
D. Nested Segmentstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n segments on a line. Ther原创 2017-05-26 22:24:54 · 359 阅读 · 0 评论 -
D - Longest Subsequence CodeForces - 632D
http://codeforces.com/problemset/problem/632/D题意:给一段序列和一个正整数m,求这段序列的一个满足条件的最长子序列,条件是这个子序列的最小公倍数小于等于m第一想法就是暴力,从m枚举到1,对每个当前枚举的值暴力给定序列里有几个是他的因子,然后类似素筛将他的因子全都标记掉,遇到标记的值直接跳过,结果t了,复杂度也不是很好计算,后来想了一些优化也是不原创 2017-05-25 21:59:49 · 433 阅读 · 0 评论 -
Beautiful numbers CodeForces - 55D 数位dp
D. Beautiful numberstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVolodya is an odd boy and his taste is原创 2017-05-15 21:39:43 · 599 阅读 · 0 评论 -
Codeforces Round #410 (Div. 2) D. Mike and distribution 思维
D. Mike and distributiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has always been thinking abou原创 2017-04-23 23:34:52 · 544 阅读 · 0 评论 -
Codeforces Round #410 (Div. 2) C. Mike and gcd problem 贪心
C. Mike and gcd problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has a sequence A = [a1, a2, ..原创 2017-04-22 09:43:53 · 615 阅读 · 1 评论 -
Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C Fountains 乱搞
C. Fountainstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputArkady plays Gardenscapes a lot. Arkady wants原创 2017-05-12 11:41:25 · 737 阅读 · 0 评论 -
CodeForces - 598C 598D //Nearest vectors// Igor In the Museum
C. Nearest vectorstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the set of vectors on the原创 2017-04-04 00:23:04 · 448 阅读 · 0 评论 -
Gym - 101128C Canvas Painting 逆向思维
https://odzkskevi.qnssl.com/3699857ff0a17d77d1099699cdf4da13?v=1490503337刚开始读错题意,以为是不变序列,就想着区间dp但数据量肯定会t,,,没想到什么优化方法就放下了,后来队员发现序列是可变的。。。。任意的。。。。。想着先排序在布拉布拉布拉,一直都没有逆向思维想到哈夫曼。只怪数据结构没认真听啊。。。。想到哈夫原创 2017-03-27 13:52:48 · 886 阅读 · 0 评论 -
Gym - 101128E E - Wooden Signs dp
https://odzkskevi.qnssl.com/3699857ff0a17d77d1099699cdf4da13?v=1490503337比较丑的做法第一维滚动数组,dp【0】【i】【j】 是指上一层,以i为起点,j为终点的情况数,#includeusing namespace std;long long int dp[2][2005][2005],mo=2原创 2017-03-27 13:18:55 · 502 阅读 · 0 评论 -
B. The Meeting Place Cannot Be Changed
B. The Meeting Place Cannot Be Changedtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe main road in Byt原创 2017-03-06 21:24:00 · 632 阅读 · 0 评论 -
Codeforces Round #418 (Div. 2) C. An impassioned circulation of affection 预处理
C. An impassioned circulation of affectiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNadeko's birthda原创 2017-06-10 22:07:33 · 298 阅读 · 0 评论 -
Codeforces Round #423 (Div. 2) C. String Reconstruction思维 D. High Load 构造
C:http://codeforces.com/contest/828/problem/C题意:有一个字符串,你知道他的一些子串所在的位置,求符合条件的字典序最小的原串因为已知的数据较大,还存在较多重复的部分,直接暴力不可行可以记录原串每个位置的下一个没确定出来的字符的位置(记住next【i】),优化后可以过,时间较长#include#define eps 1e-9#defin原创 2017-07-12 19:48:44 · 603 阅读 · 0 评论 -
C. Naming Company 贪心
http://codeforces.com/contest/794/problem/C题意:两个人每个人有一个长度n的字符集合,构造一个长度为n的字符串A是希望字符串字典序越小越好,B希望字符串字典序越大越好贪心,首先可以明确A,B都有一个必选集合,A要选(n+1)/2个,必会选自己有的最小的前几个,B必选自己有的最大的前几个如果A当前能选的最小的小于B当前能选的最大的,那么必定是原创 2017-10-23 21:24:40 · 363 阅读 · 0 评论 -
CodeForces - 372C Watching Fireworks is Fun dp
http://codeforces.com/problemset/problem/372/C题意:在一条街道上(线段),有m个烟花,给出每个烟花的位置和燃放的时间,以及一个b【i】值,当烟花燃放时,你在街道的x(1=b【i】-abs(a【i】-x),刚开始你可以在任意位置,之后可以移动你的位置,每秒可移动d个单位,求所有烟花燃放完之后的乐趣值最大值dp【i】【j】表示看完前i个烟花原创 2017-10-11 20:05:51 · 416 阅读 · 0 评论 -
Codeforces Round #439 (Div. 2) E. The Untended Antiquity 二维线段树||二维树状数组
http://codeforces.com/contest/869/problem/E题意:n*m的矩阵,q次操作,三种类型类型1:给指定矩阵加上围栏类型2:给指定矩阵去掉围栏类型3:查询两点是否存在一条不通过围栏的路加围栏是全包,也就相当于加了围栏后只能是里面走向里面,外面走向外面,这样就可以给这块平面附一个值,判断能不能走直接判相等就可以了,因为有矩阵叠加的情况,也就是围栏原创 2017-10-07 21:58:09 · 411 阅读 · 0 评论 -
Codeforces Round #432 (Div. 2) D. Arpa and a list of numbers E. Arpa and a game with Mojtaba
一个错误的贪心方法水过了小数据,没想到还水过了终测(233....)错误方法:枚举一个2和倍数在原序列出现次数较多的素数暴力求需要的花费自己都能hack自己301 100000 113 13*2-1 13*2-1 13*4-1 13*4-1 ...... 13*300-1 13*300-1结果应该是300,把除13外的所有数都加1上面的方面很明显是错的水过的代码原创 2017-09-05 17:40:32 · 314 阅读 · 0 评论 -
codeforces 451E. Devu and Flowers 组合数+容斥
题意:n个不同盒子,每个盒子里有ai个小球,总共拿s个,问有多少种选法如果盒子里求是无限个,直接插板法就可以求了对于有了个数限制,可以容斥来做,需要去掉的是个数超限的,那么我先保证他个数超限(拿ai+1个),然后对剩下的小球(s-ai-1)按原来的插板法求放法就可以了#include#define eps 1e-9#define PI 3.141592653589793#原创 2017-09-17 00:51:09 · 376 阅读 · 0 评论 -
Codeforces Round #433(Div. 1,based on Olympiad of Metropolises)A Planning B Jury Meeting C Boredom
人生的第一次div.1 掉分 QAQA - Planninghttp://codeforces.com/contest/853/problem/A贪心,排个序,优先安排花费大的,用模拟链表实现的#include#define eps 1e-9#define PI 3.141592653589793#define bs 1000000007#define bsize原创 2017-09-07 15:07:08 · 584 阅读 · 0 评论 -
Codeforces Round #420 (Div. 2) C. Okabe and Boxes 思维
http://codeforces.com/contest/821/problem/C题意:有已知的2*n条命令,分别是往栈里放一个数,或从栈顶拿出一个数并排起来,要求排的顺序必须是严格从1到n在任何时候你可以重新改变栈内元素的位置,求最少改变几次使得出栈的数排的顺序是严格从1到n的保证有解暴力思想:模拟栈操作,当出的元素不是当前要求的,则对栈内元素重新排序,必然会t优化是把排原创 2017-07-25 21:22:59 · 228 阅读 · 0 评论 -
Codeforces Round #420 (Div. 2) E. Okabe and El Psy Kongroo 矩阵快速幂+dp
题目:http://codeforces.com/contest/821/problem/E递推方程很容易看出来,dp【i】【j】表示到达( i , j )这个点的路径条数dp【i】【j】=dp【i-1】【j+1】+dp【i-1】【j】+dp【i-1】【j-1】但k太大,肯定不能直接递推,快速幂优化一下,y的坐标范围是0~15,所以矩阵长度16就够了,至于c的限制,把转移矩阵的一些位置原创 2017-08-02 16:10:18 · 269 阅读 · 0 评论 -
Codeforces Round #427 (Div. 2)C. Star sky 暴力D. Palindromic characteristics
C. Star sky题意:有很多个星星,已知星星的初始闪光值s,和坐标,闪光值的变化为s,s+1...c,0,1,2,...c,0,1,2循环会有星星坐标重叠的情况,c的范围很小,而变化时间对(c+1)取膜后同余的情况相同,可以先把所有点在不同时间的预处理出来,然后1e9的暴力查询就行了#include#define eps 1e-9#define PI 3.1415926535原创 2017-08-01 01:52:12 · 395 阅读 · 0 评论 -
Codeforces Round #424 (Div. 2)C. Jury Marks 暴力 D. Office Keys 二分 E. Cards Sorting 树状数组
C:http://codeforces.com/contest/831/problem/C。题意:给两个序列a和b有一个初始值,不断的加ai,要求是在加的过程中b的所有值都出现过,求这样满足条件的初始值有几个。崩了,这么水的暴力竟然没想出来??先把所有的b值标记出来,随便选一个b,暴力放到某一个a后面,这样就可以直接找出原序列,看看b数组里的值是不是都出现过,如果出现过则这个序列满原创 2017-07-17 16:22:51 · 572 阅读 · 0 评论 -
Codeforces Round #422 (Div. 2) C. Hacker, pack your bags! 思维排序或二分
题目:http://codeforces.com/contest/822/problem/C题意:给多个区间,每个区间都有一个权值,求两个长度和为x的区间的最小权值和。思路1:像这种找两个区间的问题,对于每个区间只需考虑在他左面的或只需考虑在他右面的即可,不需要都考虑,就像区间1 区间2 和区间2 区间1 效果是一样的维护一个need【i】表示长度为i的区间的最小权值,至于如何保证原创 2017-07-17 15:08:07 · 413 阅读 · 0 评论 -
Codeforces Round #398 (Div. 2) B. The Queue
B. The Queuetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFinally! Vasya have come of age and that means原创 2017-02-23 13:01:34 · 363 阅读 · 0 评论 -
CodeForces - 361D Levko and Array二分加dp
D. Levko and Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLevko has an array that consists of inte原创 2017-03-10 14:25:24 · 766 阅读 · 0 评论 -
Codeforces Round #404 (Div. 2) C. Anton and Fairy Tale
C. Anton and Fairy Taletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton likes to listen to fairy tales原创 2017-03-20 11:31:55 · 194 阅读 · 0 评论 -
Codeforces Round #301 (Div. 2)B. School Marks//CodeForces - 540B 贪心
B. School Markstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Vova studies programming in an elite原创 2017-02-10 22:45:39 · 279 阅读 · 0 评论 -
Codeforces Round #401 (Div. 2) A~E
http://codeforces.com/contest/777 (Codeforces Round #401 (Div. 2) )好的嘛,最简单的一次cf,也是做的最差的一次abc大数据全挂。。。。。。。。。。。A.是那个状态数组少写一个。。在纸上写对了#include#include#include#include#include#include#i原创 2017-02-24 23:24:30 · 234 阅读 · 0 评论 -
Codeforces Round #390 (Div. 2//754D. Fedor and coupons
D. Fedor and couponstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAll our characters have hobbies. The s原创 2017-01-12 12:25:45 · 519 阅读 · 0 评论 -
codeforces 8VC Venture Cup 2017 - Elimination Round D PolandBall and Polygon
D. PolandBall and Polygontime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolandBall has such a convex poly原创 2017-01-16 16:01:05 · 627 阅读 · 0 评论 -
Codeforces Good Bye 2016 C.New Year and Rating//qduoj 三亿河老师的上分梦想
C. New Year and Ratingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEvery Codeforces user has rating, de原创 2016-12-31 14:36:34 · 520 阅读 · 0 评论 -
Codeforces Round #100//140C - New Year Snowmen C. New Year Snowmen
New Year Snowmentime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs meticulous Gerald sets the table and ca原创 2016-11-27 15:15:16 · 428 阅读 · 0 评论 -
Codeforces Round #381 (Div. 2) A Alyona and copybooks
A. Alyona and copybookstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle girl Alyona is in a shop to b原创 2016-11-24 02:27:09 · 357 阅读 · 0 评论 -
Codeforces Round #380 (Div. 2,Based on Technocup 2017 - Elimination Round 2)C - Road to Cine//
C. Road to Cinematime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is currently at a car rental service原创 2016-11-23 21:45:08 · 637 阅读 · 0 评论 -
CodeForces - 148D. Bag of mice//Codeforces Round #105 (Div. 2)
D. Bag of micetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe dragon and the princess are arguing abou原创 2016-12-11 17:05:28 · 226 阅读 · 0 评论 -
Codeforces Round #378 (Div. 2) 733C Epidemic in Monstropolis
C. Epidemic in Monstropolistime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere was an epidemic in Monstro原创 2016-11-01 20:26:29 · 286 阅读 · 0 评论