1 2 3 4
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 20 下一页
摘要: https://codeforces.com/contest/1400/problem/E 可以横着把有连续的数字-1,或者把某一个数字清0,问你最少操作几次,分治 555 555 555操作3次,1 1 1操作1次 具体看代码把 #include<iostream> #include<cstrin 阅读全文
posted @ 2020-09-17 16:40 Lesning 阅读(116) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P3761 这是个神仙题,会卡常 题目让你改一条边把直径变得最短。 枚举每条边,会把图分成两个地方,两个连通块(x区和y区域)都换根dp一下,算出离x最远的点的距离记为dis【x】。然后枚举一下 新直径有三个来源 1 max dis[ 阅读全文
posted @ 2020-09-17 12:06 Lesning 阅读(162) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1407/problem/E 玄学题,有一个重要的事情,反向建边,边指向的点颜色一致,那就从n开始bfs,第一次遇到必定要和边反色,因为不反色的话路就短了。。。(第一次遇到的路一定是最短的) 具体看代码,写法简单,参考LDK神仙 #inc 阅读全文
posted @ 2020-09-15 22:30 Lesning 阅读(124) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1407/problem/D 这神仙题啊,举个例子 4 5 6 5 6 3 这样的序列如何建边? //先只考虑中间部分比i j大的 4 4 5 4 5 4 5 6 5 6 4 5 5 5 5 4 5 4 5 6 5 6 3 4 5 6 3 阅读全文
posted @ 2020-09-15 19:49 Lesning 阅读(145) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/5671/H 这个题前导0是无所谓的 dp[pos][a][b][up][up2],pos 100(位置),a,b1000(a数字和b数字的和),up,up2(a是否达到N的上界,b是否达到a的上界) 3,会超时,需要优化 试想 阅读全文
posted @ 2020-09-12 09:47 Lesning 阅读(210) 评论(0) 推荐(0) 编辑
摘要: https://codeforces.com/contest/1405/problem/D 我是zz,看错题了,其实就两种可能 1.开局直接被抓住 disA >= dis(a,b) 2.逃跑,但是如何跑呢?我们发现,db >= 2*da + 1就能跑的了,因为db小的化迟早会被抓住,放风筝就好了,看 阅读全文
posted @ 2020-09-10 21:36 Lesning 阅读(188) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P3413 回文长度2或者3就可以裁定,值得注意的是dp[pos][pre][ppre]可能应对3334321和5554321(都有321),所以要引入最新的变量才行。 dp[pos][pre][ppre][sum],具体套了板子,返 阅读全文
posted @ 2020-09-10 15:35 Lesning 阅读(113) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2602 挺简单 的其实,板子题 真实的模板 #include<bits/stdc++.h> using namespace std; typedef long long ll; int len,a[2000]; ll l,r,dp 阅读全文
posted @ 2020-09-09 21:17 Lesning 阅读(146) 评论(0) 推荐(0) 编辑
摘要: https://leetcode-cn.com/problems/count-all-possible-routes/ dp[x][y]从x到终点,使用y的油。 具体看注释 #include<iostream> #include<algorithm> #include<cstring> #inclu 阅读全文
posted @ 2020-09-08 19:29 Lesning 阅读(210) 评论(0) 推荐(0) 编辑
摘要: https://ac.nowcoder.com/acm/contest/5671/J 牛客多校j题,利用线段树nlogn写出模拟的操作快速幂 可以类似给转圈用 #include<iostream> #include<set> using namespace std; typedef long lon 阅读全文
posted @ 2020-09-07 19:43 Lesning 阅读(126) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 20 下一页