2024年9月29日
摘要: 因为洛谷出现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 阅读(12) 评论(0) 推荐(0)
摘要: #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 阅读(16) 评论(0) 推荐(0)
摘要: 注意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 阅读(21) 评论(0) 推荐(0)
摘要: #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 阅读(12) 评论(0) 推荐(0)
摘要: #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 阅读(31) 评论(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 阅读(25) 评论(0) 推荐(0)
摘要: 方法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 阅读(11) 评论(0) 推荐(0)
摘要: 带权并查集稍微注意下细节、 #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 阅读(22) 评论(0) 推荐(0)
摘要: 考虑利润从高到底排序,优先把利润最高的填到最接近过期的空余位置 贪心证明:如果当前a[i]被填入而填入了比最靠近过期前面的位置显然不会更优,如果没有被填入而放了另一组方案利润更大,则把属于a[i]的位置换成a[i]一定更优,两者矛盾 #include<bits/stdc++.h> using nam 阅读全文
posted @ 2024-09-29 09:56 ruoye123456 阅读(13) 评论(0) 推荐(0)
摘要: 相等放并查集里,不等直接判断 #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 阅读(18) 评论(0) 推荐(0)