摘要:
https://acm.hdu.edu.cn/showproblem.php?pid=7072 deque 模拟下每次加入数删除数即可,记录数是否被删除,数在左que还是右que,que中没被删除的数的个数 const int maxn = 2e7 + 7; int n, t, m, x, sizl 阅读全文
摘要:
https://acm.hdu.edu.cn/showproblem.php?pid=7067 分情况讨论,k=1,k为奇数,k为偶数 特判第一个人直接不玩的情况即可 const int maxn = 1e5 + 7; #define int long long int n, t, m, k; ve 阅读全文
摘要:
https://acm.hdu.edu.cn/showproblem.php?pid=7064 注意开数组的大小 注意优化(插入的时候判断长度是否可行) const int maxn = 1e5 + 7; int n, t, m, stp = 30; int nex[maxn * 33][27], 阅读全文
摘要:
https://www.luogu.com.cn/problem/P3674 a - b = x 可以转换成 a = b + x.用bitset记录区间数的种类,存在a - b = x 等价于 bitset & bitset<<x 是否有1 a + b = x 可以记b = N - B,也就是判断 阅读全文
摘要:
莫队 普通莫队 注意顺序正确!! codes for (int i = 1; i <= m; i++) { int pl = q[i].l, pr = q[i].r; while (l > pl) add(a[--l]); while (r < pr) add(a[++r]); while (l < 阅读全文
摘要:
https://codeforces.ml/contest/1469/problem/D 显然,容易构造n+20步完成.而在多出5步的情况下考虑每次保留sqrt(n) 按照下面进行构造: \([1,2,3,4,5,6,7,8,9] to [1,2,3,1,1,1,1,1,9] to [1,2,3,1 阅读全文
摘要:
https://codeforces.com/contest/1313/problem/C2 单调栈维护下每个位置向前向后单调的最大和 const int maxn = 5e5 + 7; #define int long long int n, t, m; int a[maxn], pre[maxn 阅读全文
摘要:
百度之星2021 初试1 https://acm.hdu.edu.cn/showproblem.php?pid=6998 const int maxn = 1e6 + 7; int n, t, m, k; int dp[maxn]; void solve() { cin >> t; while (t 阅读全文
摘要:
字典树 https://vjudge.net/problem/UVALive-3942/origin 字典树维护dp转移 记忆化搜索. const int maxn = 2e6 + 7; const int mod = 20071027; int n, t, m; int dp[maxn], nex 阅读全文
摘要:
莫队 普通莫队 注意顺序正确!! codes for (int i = 1; i <= m; i++) { int pl = q[i].l, pr = q[i].r; while (l > pl) add(a[--l]); while (r < pr) add(a[++r]); while (l < 阅读全文
摘要:
第二场牛客多校 k: https://ac.nowcoder.com/acm/contest/11253/K //栈模拟 const int maxn = 1e5 + 7; const int mod = 1e9 + 7; int n, m, k, t, a[maxn], b[maxn]; int 阅读全文