上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 35 下一页
摘要: 题目链接:https://www.acwing.com/problem/content/102/ 求出$a[i]$的差分数列$b[i]$,题目的目的是使$b_2,\ldots,b_n$都变为$0$, 令 \(p,q\) 分别为${b_i}$中正数和负数之和的绝对值, 优先在$b_2,\ldots,b 阅读全文
posted @ 2020-11-01 17:01 Tartarus_li 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.acwing.com/problem/content/101/ 维护二维前缀和,扫一遍边长为$R$的正方形的最大值即可,注意边界不要溢出 #include<cstdio> #include<cstring> #include<algorithm> #include< 阅读全文
posted @ 2020-11-01 16:40 Tartarus_li 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.acwing.com/problem/content/100/ 为方便运算,城市编号从$0$开始, 按城市分级递归求解$D$编号城市的坐标 注意变换后坐标的计算(坐标从$(0,0)$开始) 四舍五入用$%0lf$即可 #include<cstdio> #includ 阅读全文
posted @ 2020-11-01 16:22 Tartarus_li 阅读(64) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.acwing.com/problem/content/98/ 设$d[n]$表示$n$盘$3$塔问题的最小步数,$f[n]$表示$n$盘$4$塔问题的最小步数 则$f[n] = min_{1 \leq i< n}{2*f[i]+d[n-i]}$ 其中$f[1] = 阅读全文
posted @ 2020-11-01 13:04 Tartarus_li 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.acwing.com/problem/content/description/97/ 有几个重要性质: 每个位置最多被点击一次 若第一行状态固定,那么满足题目要求的点击方案最多只有一种 点击的先后顺序不影响最终结果 于是将每行的状态用二进制数存储,枚举第一行的点击状 阅读全文
posted @ 2020-11-01 12:14 Tartarus_li 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://darkbzoj.tk/problem/3668 从高位到低位依次计算,注意什么什么能用 $1$ 留坑,把之前$wa$的码写对 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> 阅读全文
posted @ 2020-10-31 20:08 Tartarus_li 阅读(68) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/93/ \(dp[S][i]\) 表示经过点的状态为 \(S\) , 当前在 \(i\) 点时的最短路 时间复杂度$O(n2*2n)$ #include<cstdio> #include<cstring> #include 阅读全文
posted @ 2020-10-31 18:29 Tartarus_li 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 要求$O(n)$的时间和$O(1)$的空间 阅读全文
posted @ 2020-10-31 17:59 Tartarus_li 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/problemset/problem/1437/C 用时少的一定比用时大的先拿更优,所以按用时大小排个序, 然后按顺序 \(dp\),用时最多不会超过 $2*n$ #include<cstdio> #include<cstring> #incl 阅读全文
posted @ 2020-10-29 21:24 Tartarus_li 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://codeforces.com/problemset/problem/1437/D 模拟一遍 bfs,因为儿子是单增的,所以每一段单增的连续子序列肯定是贪心地在一个儿子里的, 这样就能保证高度最小了 #include<cstdio> #include<cstring> #in 阅读全文
posted @ 2020-10-29 20:13 Tartarus_li 阅读(227) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 35 下一页