09 2024 档案
摘要:Mr. Wow and Lucky Array 我们可以打一个表找规律,我们会发现,最大的合法的就是 \(0, 1, 0, 1......\),那么假如这个重合了,我们可以把 \(2, 3\) 调换一下顺序即可 #include <bits/stdc++.h> using namespace std
阅读全文
摘要:The Only Way to the Destination 首先假如两个墙之间的间隔大于等于二了,那么就直接输出 \(no\),如果能在图的空隙中找到一个 \(2 * 2\) 的矩形,那么也是输出 \(no\),然后我们可以把每一列看成一个点,再把每个空隙看成一条边即可,用并查集维护 A Sim
阅读全文
摘要:String of yuusaan 我们可以打表,我们会发现字符串无论重复多少次都会遵循这个规律 #include <bits/stdc++.h> using namespace std; #define int long long int a, b; signed main() { cin >>
阅读全文
摘要:Tree Journey 猜结论 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e5 + 5; int n, k, ans, dep[N]; vector<int> g[N]; v
阅读全文
摘要:Red Pandaships 我们会发现如果有奇数个熊猫被夹在两个熊猫之间,那么一定会相交 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 3e5 + 5; int t, n, m;
阅读全文
摘要:Fun is Counting 我们可以发现数组 \(a\) 必须是 \(x\) 或 \(x - 1\),然后分类讨论即可 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e6 +
阅读全文
摘要:2集合間距離 有两种方法,我选择了更劣的做法,呜呜呜!我是暴力枚举每个点,然后对与另一个集合里的点枚举横坐标,用二分找到纵坐标上距离最小的点, \(xhr\) 写的是直接多源广搜,我的时间复杂度为 \(O(n * 1000)\),他的时间复杂度为 \(O(n)\),在线膜拜 #include <bi
阅读全文
摘要:New Dimensions 我们假设枚举 \(a, b\) 那么我们显然可以发现 \(a^2 + b^2 + c^2 - ab - ab - bc\) 中 \(c\) 越大越好 #include <bits/stdc++.h> using namespace std; #define int lo
阅读全文
摘要:Alternating String 我们可以设状态 \(dp[i][0/1][0/1]\) 表示当前考虑到第几个,长度为奇数还是偶数,有没有用 \(1\) 操作 #include <bits/stdc++.h> using namespace std; const int N = 4e5 + 5,
阅读全文
摘要:Room Temperature 我们首先可以发现他的初始适宜温度是无关紧要的(因为我们可以让他穿非常多的衣服,然后后续的操作就等于脱衣服),然后我们将数组统一模 \(T\),再排序,假设现在我们考虑第 \(i\) 个人,那么一定可以通过脱衣服,让温度在 \(a[i]\) 至 \(a[i - 1]
阅读全文
摘要:Music Festival 我们设状态为当前的炫酷值为 \(i\),则 \(dp_i\) 表示炫酷值,然后将每个专辑按照最大值排序即可 #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; struct node
阅读全文
摘要:思路 如果说给你一个数组,有 \(q\) 组询问,询问一个区间的区间和,那么有最原始的做法。维护一个左端点和一个右端点,每次一位一位移动断点,那么时间复杂度是 \(n \times q\),那么如果我们将查询存起来,按一种我们想要的顺序去做呢?我们就可以排序,排序规则就是: B = sqrt(n);
阅读全文
摘要:问题 给定一个数组 \(A = [a_1, a_2,...a_n]\) ,其中 \(a_i ≤ 2d\) ,在 A 中选择元素的某个子集,并将它们 XOR。求你能得到的不同元素的个数。 思路 显然可以得到一个效率非常劣的做法 x[0].insert(0); for (int i = 1; i <=
阅读全文
摘要:Sternhalma 我们给格子编个号,然后暴力打表出一个格子可以走到哪些点,然后状压 \(dp\),从全 \(1\) 的情况开始倒推,每次查询将其转化为二进制数列即可 #include <bits/stdc++.h> using namespace std; using pii = pair<in
阅读全文
摘要:Goals, Goals! Everywhere 先考虑最大的情况,那就是没有助攻,全是进球,观察样例,发现好像最小进球数好像就是最大数除以 \(2\),但是有一种特殊情况,就是最大的那个球员比剩下的球员加起来还多(C罗和国足) #include <bits/stdc++.h> using name
阅读全文
摘要:鸭棋 大模拟,实在不知道思维上有啥难的,就是难写!!!!!!!!!!!!!!!!!!!!! #include <bits/stdc++.h> using namespace std; struct chess { string color, type; } chessboard[10][9]; st
阅读全文
摘要:Increase/Decrease/Copy 我们可以先将 \(a_i\) 变为 \(b_i\),统计在变化的过程中与 \(b_{i + 1}\)的最少差值即可 #include <bits/stdc++.h> using namespace std; #define int long long c
阅读全文
摘要:天天爱跑步 假设现在又一棵树 如果一个人要从 \(3\) 跑到 \(5\),那么如果在 \(2\) 点的观察员要满足 \(w[2] = dep[2] - dep[3]\),如果在点 \(4\) 的观察员要满足 \(w[4] = dep[fa[lca]] - dep[3] + dep[lca] - d
阅读全文
摘要: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]
阅读全文

浙公网安备 33010602011771号