摘要:
短路 显然可以得出一个结论,一个数字大的点肯定要到一个数字比他小的点,这个我们可以用单调栈维护出来比一个点小的第一个点,然后 \(dp\) 即可 #include <bits/stdc++.h> using namespace std; #define int long long const int 阅读全文
摘要:
Back to School '24 P1 - Kicking 按照题意模拟即可 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e5 + 5; int n, m, k; char 阅读全文
摘要:
公交车(bus) 显然的题目,答案就是所有连通块的大小减一之和 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e7 + 5; int n, m, fa[N], sz[N], ans 阅读全文
摘要:
缩进优化 我们可以枚举 \(i\) 的所有倍数,我们让每一块中的数除以 \(i\) 相等,显然这是调和集数 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 1e7 + 5, INF = 阅读全文
摘要:
跳蚤os 我们可以考虑使用线段树 #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; struct node { int son[27]; } trie[500005]; struct F { int x; str 阅读全文