09 2024 档案
Interval GCD(单点修改线段树)
摘要:细节不少 //根据更相减损法gcd(x,y) = gcd(x,y-x) //推广到三项为gcd(x,y,z) = gcd(x,y-x,z-y) //可以推广到n项 #include<bits/stdc++.h> using namespace std; #define x first #define 阅读全文
posted @ 2024-09-30 14:42 ruoye123456 阅读(12) 评论(0) 推荐(0) 编辑
Can you answer these queries III(单点修改线段树)
摘要:因为洛谷出现UE在acwing提交,输入格式略有修改 #include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long 阅读全文
posted @ 2024-09-29 18:19 ruoye123456 阅读(3) 评论(0) 推荐(0) 编辑
[USACO03Open] Lost Cows(二分加树状数组)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-29 17:27 ruoye123456 阅读(4) 评论(0) 推荐(0) 编辑
P3372 【模板】线段树 1
摘要:注意size信息应该存放在info里和tag运算,已经tag是表示子树未处理的信息 #include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typ 阅读全文
posted @ 2024-09-29 16:35 ruoye123456 阅读(4) 评论(0) 推荐(0) 编辑
P3368 【模板】树状数组 2
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-29 15:32 ruoye123456 阅读(4) 评论(0) 推荐(0) 编辑
P10589 楼兰图腾(树状数组)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-29 14:08 ruoye123456 阅读(14) 评论(0) 推荐(0) 编辑
食物链(并查集)
摘要:一开始默认为0,如果有捕食关系调整d[x] #include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; t 阅读全文
posted @ 2024-09-29 13:38 ruoye123456 阅读(15) 评论(0) 推荐(0) 编辑
[CEOI1999] Parity Game(并查集)
摘要:方法1:带权路径维护 本题核心:[a,b]之间有奇数个1转换为s[a-1]^s[b] = 1,从而转向并查集 #include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int, 阅读全文
posted @ 2024-09-29 13:12 ruoye123456 阅读(3) 评论(0) 推荐(0) 编辑
[NOI2002] 银河英雄传说(带权并查集)
摘要:带权并查集稍微注意下细节、 #include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef u 阅读全文
posted @ 2024-09-29 10:41 ruoye123456 阅读(9) 评论(0) 推荐(0) 编辑
Supermarket(并查集)
摘要:考虑利润从高到底排序,优先把利润最高的填到最接近过期的空余位置 贪心证明:如果当前a[i]被填入而填入了比最靠近过期前面的位置显然不会更优,如果没有被填入而放了另一组方案利润更大,则把属于a[i]的位置换成a[i]一定更优,两者矛盾 #include<bits/stdc++.h> using nam 阅读全文
posted @ 2024-09-29 09:56 ruoye123456 阅读(6) 评论(0) 推荐(0) 编辑
P1955 [NOI2015] 程序自动分析(并查集)
摘要:相等放并查集里,不等直接判断 #include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef 阅读全文
posted @ 2024-09-29 09:31 ruoye123456 阅读(5) 评论(0) 推荐(0) 编辑
Supermarket(贪心)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef long long ll; typedef pair<int,int> PII; void solve() { int n; w 阅读全文
posted @ 2024-09-16 21:03 ruoye123456 阅读(5) 评论(0) 推荐(0) 编辑
2024 CCPC Online
摘要:A(军训I) 大分类讨论 #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") //如果在不支持 avx2 的平台上将 avx2 换成 avx 或 SSE 之一 #includ 阅读全文
posted @ 2024-09-14 11:28 ruoye123456 阅读(27) 评论(0) 推荐(0) 编辑
P4551 最长异或路径(树上前缀异或01-trie)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-14 11:04 ruoye123456 阅读(3) 评论(0) 推荐(0) 编辑
P10471 最大异或对 The XOR Largest Pair(01trie)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-14 10:41 ruoye123456 阅读(5) 评论(0) 推荐(0) 编辑
P10470 前缀统计(trie树)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-14 10:29 ruoye123456 阅读(9) 评论(0) 推荐(0) 编辑
PERIOD - Period(kmp求border)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-14 10:11 ruoye123456 阅读(3) 评论(0) 推荐(0) 编辑
P10469 后缀数组(Hash+二分)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-14 09:49 ruoye123456 阅读(19) 评论(0) 推荐(0) 编辑
P10468 兔子与兔子(Hash)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 21:35 ruoye123456 阅读(7) 评论(0) 推荐(0) 编辑
P10467 [CCC 2007] Snowflake Snow Snowflakes(Hash)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 20:30 ruoye123456 阅读(11) 评论(0) 推荐(0) 编辑
P1168 中位数(对顶堆)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 20:15 ruoye123456 阅读(6) 评论(0) 推荐(0) 编辑
P1115 最大子段和(DP)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 17:25 ruoye123456 阅读(2) 评论(0) 推荐(0) 编辑
P10466 邻值查找
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 17:22 ruoye123456 阅读(7) 评论(0) 推荐(0) 编辑
Team Queue(队列)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 12:52 ruoye123456 阅读(17) 评论(0) 推荐(0) 编辑
HISTOGRA - 最大矩形面积(单调栈)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 11:57 ruoye123456 阅读(6) 评论(0) 推荐(0) 编辑
P1044 [NOIP2003 普及组] 栈
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 11:56 ruoye123456 阅读(6) 评论(0) 推荐(0) 编辑
P2201 数列编辑器(对顶栈)
摘要:#include<bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> PII; typedef long long ll; typedef unsigned long l 阅读全文
posted @ 2024-09-13 11:55 ruoye123456 阅读(7) 评论(0) 推荐(0) 编辑