摘要: 问题 给定一个数组 \(A = [a_1, a_2,...a_n]\) ,其中 \(a_i ≤ 2d\) ,在 A 中选择元素的某个子集,并将它们 XOR。求你能得到的不同元素的个数。 思路 显然可以得到一个效率非常劣的做法 x[0].insert(0); for (int i = 1; i <= 阅读全文
posted @ 2024-09-23 15:25 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑
摘要: Sternhalma 我们给格子编个号,然后暴力打表出一个格子可以走到哪些点,然后状压 \(dp\),从全 \(1\) 的情况开始倒推,每次查询将其转化为二进制数列即可 #include <bits/stdc++.h> using namespace std; using pii = pair<in 阅读全文
posted @ 2024-09-23 12:02 libohan0518 阅读(5) 评论(0) 推荐(0) 编辑
摘要: Goals, Goals! Everywhere 先考虑最大的情况,那就是没有助攻,全是进球,观察样例,发现好像最小进球数好像就是最大数除以 \(2\),但是有一种特殊情况,就是最大的那个球员比剩下的球员加起来还多(C罗和国足) #include <bits/stdc++.h> using name 阅读全文
posted @ 2024-09-23 11:47 libohan0518 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 鸭棋 大模拟,实在不知道思维上有啥难的,就是难写!!!!!!!!!!!!!!!!!!!!! #include <bits/stdc++.h> using namespace std; struct chess { string color, type; } chessboard[10][9]; st 阅读全文
posted @ 2024-09-23 11:31 libohan0518 阅读(6) 评论(0) 推荐(0) 编辑
摘要: Increase/Decrease/Copy 我们可以先将 \(a_i\) 变为 \(b_i\),统计在变化的过程中与 \(b_{i + 1}\)的最少差值即可 #include <bits/stdc++.h> using namespace std; #define int long long c 阅读全文
posted @ 2024-09-23 11:25 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 天天爱跑步 假设现在又一棵树 如果一个人要从 \(3\) 跑到 \(5\),那么如果在 \(2\) 点的观察员要满足 \(w[2] = dep[2] - dep[3]\),如果在点 \(4\) 的观察员要满足 \(w[4] = dep[fa[lca]] - dep[3] + dep[lca] - d 阅读全文
posted @ 2024-09-23 11:06 libohan0518 阅读(2) 评论(0) 推荐(0) 编辑
摘要: Minimum MEX 用双指针,如果 \(mex\) 小于了就往大扩展 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e5 + 5; int t, n, a[N], cnt[N] 阅读全文
posted @ 2024-09-23 10:37 libohan0518 阅读(5) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2024-09-08 13:11 libohan0518 阅读(2) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2024-09-06 18:00 libohan0518 阅读(2) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2024-08-19 20:28 libohan0518 阅读(1) 评论(0) 推荐(0) 编辑