摘要: dp 每个物品有自身价值和它的挂钩数 看上去挂钩是更重要的,所以我们在考虑时先挂挂钩多的 有些像背包 [i][j]的状态应该是有 1.这个不挂 2.挂上,MAX(上的状态+val ,挂钩+num ) 1 #include<bits/stdc++.h> 2 3 using namespace std; 阅读全文
posted @ 2021-07-28 13:43 Hehe_0 阅读(36) 评论(0) 推荐(0)
摘要: zbk学长掏出来的“小清醒”题 我们通过审题 显然可以得出 看上去我可以知道操作次数最多为n 并且每个数字的操作次数最多为1 (使所有gcd()>1,最坏情况是都为互质的奇数 正解是:随机!!! 由于每个数字最多只有操作不操作的选项 如果是随机的话,一个元素就有0.5的几率会被操作 只要rand的次 阅读全文
posted @ 2021-07-28 11:25 Hehe_0 阅读(55) 评论(0) 推荐(0)
摘要: 二分图的题 可以分别以行列和列行建 1.二分图 #include<bits/stdc++.h> using namespace std; const int N=555; int n,m; char c[N][N]; int a[N][N],b[N][N]; int flag[N<<5],match 阅读全文
posted @ 2021-07-17 18:54 Hehe_0 阅读(52) 评论(0) 推荐(0)
摘要: 抓住题中可以转化的信息,使题面变为我们熟悉的类型 将颜色看为点,珠子作为边(由于欧拉图性质) #include<bits/stdc++.h> using namespace std; int n; //以颜色为点建图,珠子为边建图qwq int G[66][66],ind[66]; int sta; 阅读全文
posted @ 2021-07-17 14:56 Hehe_0 阅读(36) 评论(0) 推荐(0)
摘要: 注意寻找题面隐藏关系 #include<bits/stdc++.h> using namespace std; const int N=1e5+7; int n,cnt,x,tot,t; int head[N],nxt[N<<1],to[N<<1]; int match[N],flag[N]; in 阅读全文
posted @ 2021-07-17 14:51 Hehe_0 阅读(55) 评论(0) 推荐(0)
摘要: 差分约束的题 不多说 #include<bits/stdc++.h> using namespace std; const int N=1e5+7; int n,m; int head[N],nxt[N<<2],to[N<<2],edge[N<<2]; int d[N],flag[N],num[N] 阅读全文
posted @ 2021-07-17 10:48 Hehe_0 阅读(45) 评论(0) 推荐(0)
摘要: by luogu 可持久练习题 3个操作 1.T x:在文章末尾打下一个小写字母 xx。(type 操作 ) 2.U x:撤销最后的 xx 次修改操作。(Undo 操作) (注意 Query 操作并不算修改操作) Q x:询问当前文章中第 xx 个字母并输出。(Query 操作) 文章一开始可以视为 阅读全文
posted @ 2021-07-14 08:20 Hehe_0 阅读(115) 评论(0) 推荐(0)
摘要: by luogu 貌似原先是bzoj 的 T 一个背包方案 数 不选当前物品的方案数 = 总的方案数 - 选当前物品的方案数 #include<bits/stdc++.h> using namespace std; const int N=2021; int n,m; int a[N]; int d 阅读全文
posted @ 2021-07-13 14:38 Hehe_0 阅读(54) 评论(0) 推荐(0)
摘要: by luogu https://www.luogu.com.cn/problem/P2113 一个dp题 dp[i][j][k]表示 前i个,选了t个,小红满意度j时 小明的最大满意度 #include<bits/stdc++.h> using namespace std; int n,m,k,c 阅读全文
posted @ 2021-07-11 21:31 Hehe_0 阅读(54) 评论(0) 推荐(0)
摘要: by luogu 开了一个并查集的题 题意有些混乱 脑子抽了写的注释有些#!@¥%…………¥ 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 5 int n,m,k,g; 6 int f[333]; 7 8 void init() 9 {// 阅读全文
posted @ 2021-06-25 15:59 Hehe_0 阅读(118) 评论(0) 推荐(0)