上一页 1 2 3 4 5 6 7 8 9 ··· 27 下一页
摘要: auto getMin = [](vector<int> &v)->vector<int> { int n = v.size(); int k = 0, i = 0, j = 1; while (k < n && i < n && j < n) { if (v[(i + k) % n] == v[( 阅读全文
posted @ 2025-06-05 16:39 Ke_scholar 阅读(13) 评论(0) 推荐(0)
摘要: 洛谷模板题AC通过 #include <bits/stdc++.h> using namespace std; using i64 = long long; int P; template<class Node> struct SegmentTree { #define lc u<<1 #defin 阅读全文
posted @ 2025-05-25 15:49 Ke_scholar 阅读(25) 评论(0) 推荐(0)
摘要: 将佬[1]$的值域分块封装了一下,洛谷过了 template <typename T> struct Block { int B, N, tot; vector<T> cnt, Cnt, L, R, belong; Block(int n): N(n - 1), B(sqrt(n - 1)), cn 阅读全文
posted @ 2025-05-23 21:24 Ke_scholar 阅读(9) 评论(0) 推荐(0)
摘要: struct DSU { vector<int> fa, sz, st; DSU(int n) { fa.resize(n); sz.assign(n, 1); iota(fa.begin(), fa.end(), 0); } int find(int x) { return fa[x] == x 阅读全文
posted @ 2025-05-14 17:10 Ke_scholar 阅读(18) 评论(0) 推荐(0)
摘要: 2025牛客寒假算法基础集训营6 A-复制鸡_2025牛客寒假算法基础集训营6 (nowcoder.com) 思路 将连续的元素看成一个即可。 代码 #include <bits/stdc++.h> using namespace std; using i64 = long long; void s 阅读全文
posted @ 2025-02-16 20:47 Ke_scholar 阅读(46) 评论(0) 推荐(0)
摘要: SMU winter 2025 Personal Round 3 A. Vasya and Book 思路 计算从起始页 \(x\) 到目标页 \(y\) 的最小按键次数。每次按键可向前或向后滚动 \(d\) 页,但不可越界。解题关键在于分析三种可能路径: 直接移动:若 \(|x - y|\) 能被 阅读全文
posted @ 2025-02-16 14:20 Ke_scholar 阅读(12) 评论(0) 推荐(0)
摘要: 2025牛客寒假算法基础集训营5 小L的三则运算 思路 签到。 代码 #include <bits/stdc++.h> using namespace std; using i64 = long long; int main() { ios::sync_with_stdio(false); cin. 阅读全文
posted @ 2025-02-09 19:26 Ke_scholar 阅读(25) 评论(0) 推荐(0)
摘要: 2025寒假天梯赛训练3 L1-1 今天我要赢 思路 代码 I'm gonna win! Today! 2022-04-23 L1-2 种钻石 思路 代码 #include <bits/stdc++.h> using namespace std; using i64 = long long; int 阅读全文
posted @ 2025-02-09 19:25 Ke_scholar 阅读(34) 评论(0) 推荐(0)
摘要: 2025牛客寒假算法基础集训营4 Tokitsukaze and Balance String (easy) 思路 暴力枚举即可,复杂度 \(\mathcal{O}(2^nn^2)\)。 代码 #include <bits/stdc++.h> using namespace std; using i 阅读全文
posted @ 2025-02-09 19:25 Ke_scholar 阅读(14) 评论(0) 推荐(0)
摘要: SMU winter 2025 Personal Round 2 A. Ichihime and Triangle 思路 \(a, b, c, d\) 单调递增,所以 \(x, y, z\) 也会单调递增。这时只需要满足 \(x + y > z\) 就行了。 我们把 \(x, y\) 取最大值:\( 阅读全文
posted @ 2025-02-09 19:10 Ke_scholar 阅读(18) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 27 下一页