随笔分类 -  Codeforces

经典矩阵dp寻找递增最大长度
摘要:竖向寻找矩阵最大递增元素长度,因为要求至少一列为递增数列,那么每行求一下最大值就可以作为len[i]:到i行截止的最长的递增数列长度。 C. Alyona and Spreadsheet time limit per test 1 second memory limit per test 256 m 阅读全文

posted @ 2017-02-24 21:40 暴力的轮胎 阅读(510) 评论(0) 推荐(0)

【Codeforces】383.DIV2
摘要:昨天一场CF发挥不好。抽点时间总结一下,然后顺带算是做个题解。 第一题水题 第二题思路很清晰,大概十分钟就想出来规模100000明显复杂度最多nlog所以只能一遍loop然后里利用map统计得到后面的数字个数,动态更新。这里因为是严格顺序的关系,使得这种逻辑是正确的,注意细节就是对于点i来说,应该先 阅读全文

posted @ 2016-12-07 11:02 暴力的轮胎 阅读(148) 评论(0) 推荐(0)

Intel Code Challenge Elimination Round (Div.1 + Div.2, combined) C. Destroying Array -- 逆向思维
摘要:原题中需要求解的是按照它给定的操作次序,即每次删掉一个数字求删掉后每个区间段的和的最大值是多少。 正面求解需要维护新形成的区间段,以及每段和,需要一些数据结构比如 map 和 set。 map<int, LL>interval2Sum来维护区间段(u->v),mulitset<LL>sum 来维护最 阅读全文

posted @ 2016-10-02 10:23 暴力的轮胎 阅读(296) 评论(0) 推荐(0)

【Codeforces】Codeforces Round #374 (Div. 2) -- C. Journey (DP)
摘要:一道图论题,DFS t了,BFS MLE了。看来最优解应该是DP没跑了。 下面尝试定义转移方程: dp[i][j]表示在经过了i个城市之后到达编号为j的城市所消耗的最小时间。 转移方程写得好,一切问题就变的简单了。反观这题,题中一共三个变量,经历城市数(希望最大化),消耗的时间(希望最小化),当前城 阅读全文

posted @ 2016-10-01 11:53 暴力的轮胎 阅读(649) 评论(0) 推荐(0)

【Codeforces】Codeforces Round #373 (Div. 2) -C
摘要:C. Efim and Strange Grade Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive de 阅读全文

posted @ 2016-09-24 19:57 暴力的轮胎 阅读(281) 评论(0) 推荐(0)

【Codeforces】Codeforces Round #373 (Div. 2)
摘要:B. Anatoly and Cockroaches Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together wit 阅读全文

posted @ 2016-09-24 10:07 暴力的轮胎 阅读(376) 评论(0) 推荐(0)

导航