摘要: String of yuusaan 我们可以打表,我们会发现字符串无论重复多少次都会遵循这个规律 #include <bits/stdc++.h> using namespace std; #define int long long int a, b; signed main() { cin >> 阅读全文
posted @ 2024-09-29 20:59 libohan0518 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2024-09-29 18:54 libohan0518 阅读(2) 评论(0) 推荐(0) 编辑
摘要: Red Pandaships 我们会发现如果有奇数个熊猫被夹在两个熊猫之间,那么一定会相交 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 3e5 + 5; int t, n, m; 阅读全文
posted @ 2024-09-27 17:08 libohan0518 阅读(2) 评论(0) 推荐(0) 编辑
摘要: Fun is Counting 我们可以发现数组 \(a\) 必须是 \(x\) 或 \(x - 1\),然后分类讨论即可 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e6 + 阅读全文
posted @ 2024-09-27 16:46 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 2集合間距離 有两种方法,我选择了更劣的做法,呜呜呜!我是暴力枚举每个点,然后对与另一个集合里的点枚举横坐标,用二分找到纵坐标上距离最小的点, \(xhr\) 写的是直接多源广搜,我的时间复杂度为 \(O(n * 1000)\),他的时间复杂度为 \(O(n)\),在线膜拜 #include <bi 阅读全文
posted @ 2024-09-26 10:40 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑
摘要: New Dimensions 我们假设枚举 \(a, b\) 那么我们显然可以发现 \(a^2 + b^2 + c^2 - ab - ab - bc\) 中 \(c\) 越大越好 #include <bits/stdc++.h> using namespace std; #define int lo 阅读全文
posted @ 2024-09-25 21:12 libohan0518 阅读(7) 评论(0) 推荐(0) 编辑
摘要: Alternating String 我们可以设状态 \(dp[i][0/1][0/1]\) 表示当前考虑到第几个,长度为奇数还是偶数,有没有用 \(1\) 操作 #include <bits/stdc++.h> using namespace std; const int N = 4e5 + 5, 阅读全文
posted @ 2024-09-25 20:57 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑
摘要: Room Temperature 我们首先可以发现他的初始适宜温度是无关紧要的(因为我们可以让他穿非常多的衣服,然后后续的操作就等于脱衣服),然后我们将数组统一模 \(T\),再排序,假设现在我们考虑第 \(i\) 个人,那么一定可以通过脱衣服,让温度在 \(a[i]\) 至 \(a[i - 1] 阅读全文
posted @ 2024-09-25 12:04 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑
摘要: Music Festival 我们设状态为当前的炫酷值为 \(i\),则 \(dp_i\) 表示炫酷值,然后将每个专辑按照最大值排序即可 #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; struct node 阅读全文
posted @ 2024-09-23 23:08 libohan0518 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 思路 如果说给你一个数组,有 \(q\) 组询问,询问一个区间的区间和,那么有最原始的做法。维护一个左端点和一个右端点,每次一位一位移动断点,那么时间复杂度是 \(n \times q\),那么如果我们将查询存起来,按一种我们想要的顺序去做呢?我们就可以排序,排序规则就是: B = sqrt(n); 阅读全文
posted @ 2024-09-23 20:04 libohan0518 阅读(3) 评论(0) 推荐(0) 编辑