摘要: 前置::trie , kmp AC自动机 #include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 2e5 + 5; // 模式串长度之和 int tr[MAXN][26], fail[M 阅读全文
posted @ 2025-11-03 19:16 shuxin5 阅读(2) 评论(0) 推荐(0)
摘要: 水的炸天,不做解释自己看吧 #include<bits/stdc++.h> #define MAXN 2010 #define inf 0x3f3f3f3f #define int long long using namespace std; namespace SHuxinn{ struct no 阅读全文
posted @ 2025-10-12 21:08 shuxin5 阅读(4) 评论(0) 推荐(0)
摘要: 很难,赛时想的大差不差,但邪恶哈基米强制我退赛 组合数分析 因为每个空隙长度都是两边的h的max , 所以考虑把楼看成块 ,每个两个一块 ,块的长度为两个h的max, 于是n个数就能产生(n - 1)个块; 考虑情况 : 所有块加起来长度 < x 所以把那些没有覆盖到的用插板法插在每个块的空隙中 , 阅读全文
posted @ 2025-10-01 15:46 shuxin5 阅读(9) 评论(0) 推荐(0)
摘要: 组合数快速求法 #include <bits/stdc++.h> #define ll long long #define MAXN 1010 using namespace std; namespace SHuxinn{ ll pri[MAXN]; ll ni[MAXN]; ll ans1 , a 阅读全文
posted @ 2025-10-01 15:21 shuxin5 阅读(6) 评论(0) 推荐(0)
摘要: 赛时调了很长时间, 应该到蓝了, 但是比较暴力了 组合数学 dp[i][j][k]代表选到第i个点,j棵树然后需求k个儿子 我们注意到可以分类讨论,分为三种情况 { 没有儿子 一个儿子 两个儿子 } 其中第一种情况可以{ 首先考虑自己成为一个树转移显然::dp[i][j + 1][k] = (dp[ 阅读全文
posted @ 2025-09-30 20:16 shuxin5 阅读(3) 评论(0) 推荐(0)
摘要: 赛时很快想出切掉,感觉比t2恶心🤢,可能是二分做法的问题(bushi 想法简单,贪心想法保留m个最小的 ,于是二分k用来区分大数和小数 , 如果小于k/2为小数 , 显然小数是必拿 ,然后在每个小数之间最多只能有一个大数,且需要满足小数加这个大数小于k即可 然后如果最后长度小于m就找大,大于等于m 阅读全文
posted @ 2025-09-30 19:07 shuxin5 阅读(5) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; int n, m; int dis[10010]; // 存储起点到各点的最短距离 int u[10010], v[10010], w[10010]; // 边的起点、终点、权重 int first[1001 阅读全文
posted @ 2025-09-22 16:36 shuxin5 阅读(8) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int target[50001], initial[50001], people[50001][3], pluss[50001], minuss[50001]; int main() { int n; cin >> 阅读全文
posted @ 2025-09-01 16:25 shuxin5 阅读(12) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> #define int long long #define MAXN 5010 #define INF 1145141919810 using namespace std; int n , m; int a[MAXN]; struct node{ in 阅读全文
posted @ 2025-09-01 09:27 shuxin5 阅读(7) 评论(0) 推荐(0)
摘要: 应该栓是Trie模板吧 #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int son[N][26]; int cnt[N]; int idx; char str[N]; void insert(char *s 阅读全文
posted @ 2025-08-31 20:39 shuxin5 阅读(6) 评论(0) 推荐(0)