上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 24 下一页
摘要: 吉司机线段树用于维护区间[l,r]对x取最小值,区间查询最小值和区间求和. #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6+10; struct node{ int l,r; 阅读全文
posted @ 2020-11-18 17:45 popozyl 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 这题实在把我心态搞崩了 WA了一万发 错误答案吧先留着吧,以后补,今天实在没心情补了 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; const int N 阅读全文
posted @ 2020-11-18 14:58 popozyl 阅读(249) 评论(0) 推荐(0) 编辑
摘要: CodeForces - Problem 1442 A - Extreme Subtraction - DP 这是一道构造题,之前没练过构造.思路是贪心,DP #include <bits/stdc++.h> using namespace std; int n,t; int v[30000+4]; 阅读全文
posted @ 2020-11-17 15:35 popozyl 阅读(135) 评论(0) 推荐(0) 编辑
摘要: CodeForces - Problem 1447 - Catching Cheaters - DP #include <bits/stdc++.h> using namespace std; const int N = 5000+5; char a[N],b[N]; int dp[N][N]; / 阅读全文
posted @ 2020-11-17 12:22 popozyl 阅读(84) 评论(0) 推荐(0) 编辑
摘要: CodeForces - Problem 1446 - Knapsack - 思维 对于所有物品按照重量从小到大排序,然后从后向前遍历: 对于重量已经超过了$\omega$的物品,将其忽略掉; 对于重量处于$[\lceil \frac{\omega}{2} \rceil,\omega]$的物品(如果 阅读全文
posted @ 2020-11-17 10:23 popozyl 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 原文 阅读全文
posted @ 2020-11-16 16:04 popozyl 阅读(68) 评论(0) 推荐(0) 编辑
摘要: KMP 模板(修订,更易懂) 之前一篇博客简单介绍了KMP的原理,但当时写的模板两个字符串数组都是从下标为0开始的,逻辑有些混乱. 这次修改了x,y下标从1开始,感觉更加自然. #include <bits/stdc++.h> using namespace std; const int N = 1 阅读全文
posted @ 2020-11-16 09:57 popozyl 阅读(104) 评论(0) 推荐(0) 编辑
摘要: [模板] fhq Treap (无旋Treap) 模板题AcWing253.普通平衡树 教程视频 #include <cstdio> #include <algorithm> #include <queue> using namespace std; const int N = 1e5+5; str 阅读全文
posted @ 2020-11-15 21:38 popozyl 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 线段树 + 扫描线 - HDU 1255 - 覆盖的面积 对于每个区间结点,建立两个变量len1,len2 len1表示区间内被覆盖过一次且仅以次的线段长度 len2表示区间内被覆盖过大于等于两次的线段长度 因此,对于叶子结点: if(l+1==r){ if(cover[rt]==1){ tree[ 阅读全文
posted @ 2020-11-14 22:38 popozyl 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 可持久化Trie 原题链接:AcWing-256-最大异或和 题解: 可以用前缀数组O(1)解决区间异或的询问 \[ A_i\oplus A_{i+1} \oplus A_{i+2} \oplus ... \oplus A_j = (A_1 \oplus A_2 \oplus ... \oplus 阅读全文
posted @ 2020-11-13 11:04 popozyl 阅读(89) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 24 下一页