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
阅读全文
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
阅读全文
[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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
食物链(并查集)
摘要:一开始默认为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
阅读全文
[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,
阅读全文
[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
阅读全文
Supermarket(并查集)
摘要:考虑利润从高到底排序,优先把利润最高的填到最接近过期的空余位置 贪心证明:如果当前a[i]被填入而填入了比最靠近过期前面的位置显然不会更优,如果没有被填入而放了另一组方案利润更大,则把属于a[i]的位置换成a[i]一定更优,两者矛盾 #include<bits/stdc++.h> using nam
阅读全文
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
阅读全文
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
阅读全文
2024 CCPC Online
摘要:A(军训I) 大分类讨论 #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") //如果在不支持 avx2 的平台上将 avx2 换成 avx 或 SSE 之一 #includ
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文
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
阅读全文