摘要:
思路 先前缀和一遍,然后就转化成为了区间加,区间查询最值以及区间的最大子段和。 直接上线段树,维护的时候处理一下最大子段和就行了。 代码 #include<bits/stdc++.h> using namespace std;typedef long long ll;const int N=1e5+ 阅读全文
摘要:
思路 十分板,直接上线段树分裂就行了,加上一个并查集维护一下联通情况就行了。 代码 #include<bits/stdc++.h> using namespace std;typedef long long ll;const int N=1e5+10,P=1e7;char op[5]; int n, 阅读全文
摘要:
思路 模拟赛的题,有点板。 直接建出原图的 Kruscal 重构树,然后发现询问变成了一个子树内区间第 K 大。 直接转化到序列上然后主席树即可。 代码-P4197 Peaks #include<bits/stdc++.h> using namespace std;typedef long long 阅读全文