上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 65 下一页
摘要: 原题链接 题解 1.已知如果两个点之间有两条边不重合的路径,那么这两个点就在一个边强连通分量里,所以我们可以把处于同一个边强连通分量的点缩起来 在这里,我忘记了怎么求边强连通分量,所以我再提醒一下自己 已知树结构是不存在强连通分量的,它的特性是深度大的节点只有一条回到深度小的节点的边,所以我们深度搜 阅读全文
posted @ 2024-05-15 19:05 纯粹的 阅读(13) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.经过样例证明,双方的交换策略一定是自己最小值去换对面最大值 2.双方交换的最大值一定局限在双方各自初始最大值之间,最小值也是 code #include<bits/stdc++.h> #define ll long long using namespace std; int ma 阅读全文
posted @ 2024-05-15 14:10 纯粹的 阅读(14) 评论(0) 推荐(0)
摘要: 原题链接 题解 突破口:我要让bob早点没得减,我肯定选最小的那个 code #include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n; cin>>n; int x; cin 阅读全文
posted @ 2024-05-15 13:11 纯粹的 阅读(16) 评论(0) 推荐(0)
摘要: 原题链接 题解 easy.ver::只能朝一个方向走,还剩奇数个格子时先手获胜 medium.ver: 令 \(u_i\) 为根节点,这样就只能朝子节点的方向走,设 \(dp[now]\) 为当以now为根的树,且now节点已经有一颗棋(其子节点均还没有)时,先手必胜1还是必败0,状态转移方程:\( 阅读全文
posted @ 2024-05-14 20:43 纯粹的 阅读(136) 评论(0) 推荐(0)
摘要: 原题链接 题解 给定一个数组,你知道怎么计算最终答案吗? 设数组大小为 \(n\),数组中的最小值为 \(x\),大于最小值的个数为 \(p\) 则 \(ans=n*x-(n-1)+p\),\(p\in[0,n-1]\) 所以 \(x\) 越大,\(ans\) 越大 二分的前置条件有了 二分 \(x 阅读全文
posted @ 2024-05-14 19:16 纯粹的 阅读(22) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.在一次op后,哪些东西发生了变化?哪些东西没变? 2.题目要求当一个u都没有的时候先手输,那么我一次op能减几个u? 3.通过分类讨论发现一次op总是使u的数量加减一个奇数,所以如果alice要赢,那么起始u的数量必须是奇数 code #include<bits/stdc++.h 阅读全文
posted @ 2024-05-14 18:45 纯粹的 阅读(10) 评论(0) 推荐(0)
摘要: 原题链接 题解 从小正方形到大正方形,有四个变化方向,分别是左上、右上、右下、左上。 分类讨论模拟即可 code #include<bits/stdc++.h> using namespace std; int main() { int n,x,y; cin>>n>>x>>y; puts("Yes" 阅读全文
posted @ 2024-05-14 18:31 纯粹的 阅读(19) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.异或规则为不进位加法,可以看作位运算 2.查找的时间复杂度必不能高,\(log_{16}{10^{18}} · 2e5\) 2.所以,补齐前缀0,这样就能用字典树了 code #include <bits/stdc++.h> using namespace std; #defin 阅读全文
posted @ 2024-05-14 14:07 纯粹的 阅读(43) 评论(0) 推荐(0)
摘要: 原题链接 题解 看清楚题目,是三个人都坐在同一辆校车!! code #include<bits/stdc++.h> #define ll long long using namespace std; vector<ll> G[200005]; ll depth[200005]={0}; void d 阅读全文
posted @ 2024-05-14 12:48 纯粹的 阅读(11) 评论(0) 推荐(0)
摘要: 原题链接 题解 太巧妙了!!! code #include<bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; int r=0,b=0,y=0; for(int i=1;i<=n;i++) { string s; 阅读全文
posted @ 2024-05-14 12:35 纯粹的 阅读(14) 评论(0) 推荐(0)
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 65 下一页