返回顶部
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页
摘要: https://www.acwing.com/problem/content/369/ 一定要小心缩点之后只剩下一个强连通分量(一个孤立点)的时候,本身就是强连通的了。 cpp include using namespace std; typedef long long ll; const int 阅读全文
posted @ 2019-09-27 21:23 Inko 阅读(173) 评论(0) 推荐(0) 编辑
摘要: ```cpp include using namespace std; define ll long long int a[40]; ll dp[40][40][40]; ll dfs(int pos, int s1, int s2, bool lead, bool limit) { if(pos 阅读全文
posted @ 2019-09-27 20:57 Inko 阅读(151) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/description/331/ 貌似只能够从下往上反推,从上往下不知道走哪个方向好。每次找出这个平台A下落到哪个平台B,再从B的左右端点向上转移。 include using namespace std; typedef 阅读全文
posted @ 2019-09-27 20:16 Inko 阅读(254) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/341/ 求ab之间的二进制表示0的数量大于等于1的数量的数的个数,注意特判0也是合法。 cpp include using namespace std; define ll long long int a[40]; ll 阅读全文
posted @ 2019-09-27 17:11 Inko 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 区间加值,区间求和的树状数组,通过差分来实现。 并没有线段树那么通用。 cpp include using namespace std; typedef long long ll; ll bit[100005]; ll bit2[100005]; int n; void add(int x, ll 阅读全文
posted @ 2019-09-25 16:47 Inko 阅读(130) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/314/ 注意x1 using namespace std; typedef long long ll; ll a[355]; ll dp[5][41][41][41]; int cnt[5]; int main() { 阅读全文
posted @ 2019-09-24 23:01 Inko 阅读(132) 评论(0) 推荐(0) 编辑
摘要: https://www.acwing.com/problem/content/277/ 按对角线为阶段,记录x上的状态推断y进行dp,注意两个取值都是n! cpp include using namespace std; typedef long long ll; ll a[55][55]; ll 阅读全文
posted @ 2019-09-24 22:35 Inko 阅读(102) 评论(0) 推荐(0) 编辑
摘要: A Yellow Cards 给一堆黄牌,给1队、2队的人数和每个人还能吃的黄牌数,求最少和最多罚下去几个人? 数据量过小,直接模拟即可,最少就给所有非1的分配完之后,取黄牌数和人数的最小值(貌似题目数据连这个都不卡)。最多就集中火力罚当前承受度最低的。 cpp include using name 阅读全文
posted @ 2019-09-22 21:00 Inko 阅读(368) 评论(0) 推荐(0) 编辑
摘要: D Go Latin 签到题,按题意模拟就可以了,容易看漏情况,小心一点。 cpp include using namespace std; typedef long long ll; char s[1000005]; int main() { ifdef Yinku freopen("Yinku. 阅读全文
posted @ 2019-09-21 23:59 Inko 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 昨天2019年9月20日,学弟问我最长上升子序列怎么复原,这个问题想了很久才知道怎么解决,顺便想清楚了这个算法的本质,他通过二分替换元素的时候是不能更新后面的元素的,而替换的原因是因为他是新元素所以可以放在任何不比他大的元素后面。所以不能更新为f2[f1[j]]而是要f1[j 1]。注意到其实f1在 阅读全文
posted @ 2019-09-21 01:26 Inko 阅读(166) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 16 下一页