摘要: 原题链接 题解 细节颇多看代码 code #include<bits/stdc++.h> using namespace std; struct unit { int s,e; }milk[5005]; bool cmp(unit a,unit b) { return a.s<b.s; } int 阅读全文
posted @ 2024-02-16 17:33 纯粹的 阅读(60) 评论(0) 推荐(0)
摘要: 原题链接 题解1:单调栈+并查集? 单调栈特性:栈内元素大小和序号由栈底到栈顶具有单调性,本题大小单调减,序号单调增 维护:新元素入栈时,栈内剩余的所有小于该元素的元素出栈,并视新元素为集合首领,然后新元素入栈 查询:查询集合首领即可 code1 #define ll long long #incl 阅读全文
posted @ 2024-02-16 15:00 纯粹的 阅读(47) 评论(0) 推荐(0)
摘要: 原题链接 题解 code #include<bits/stdc++.h> using namespace std; int fa[1005]; int finds(int now) { return fa[now]=(now==fa[now]?now:finds(fa[now])); } vecto 阅读全文
posted @ 2024-02-16 02:31 纯粹的 阅读(54) 评论(0) 推荐(0)