正文
增加 182 行删除 7 行
1234567891011121314151624 行未改动4142434445464748495051525354555657585960616263646566676869707172737422 行未改动9798991001011021031042 行未改动10710810911011111211311411511611711811912012112212312412516 行未改动14214314414514614714814910 行未改动160161162163164165166167168169170171172 行未改动全部展开344345346347348349350351352353354355356357358359360施工中!/fendou## 数论+ [P10532](https://www.luogu.com.cn/problem/P10532):::info[sol]诈骗题,,其实就是数了 $(i,j)$ 使得 $1 \le i,j \le n \land i,j \in\mathbb{Z}$,输出 $n^2$。:::+ [P15251](https://www.luogu.com.cn/problem/P15251):::info[sol]24 行未改动+ [P6624](https://www.luogu.com.cn/problem/P6624)待补。### 证明正确性+ [P11918](https://www.luogu.com.cn/problem/P11918):::info[sol]首先按 $p_i$ 排序,选的一定是一段前缀作答。设 $dp_{i,j}$ 为前 $i$ 题得 $j$ 分的概率,暴力转移,$<\varepsilon$ 的项直接舍去,精细实现即可通过。证明的话…:::+ [P8108](https://www.luogu.com.cn/problem/P8108)待补。## 贪心+ [P10238](https://www.luogu.com.cn/problem/P10238)待补。+ [P2102](https://www.luogu.com.cn/problem/P2102)待补。+ [P14015](https://www.luogu.com.cn/problem/P14015):::info[sol]22 行未改动+ [CF1260E](https://www.luogu.com.cn/problem/CF1260E)待补。### 反悔贪心+ [P16279](https://www.luogu.com.cn/problem/P16279)2 行未改动+ [P3045](https://www.luogu.com.cn/problem/P3045)待补。## 构造+ [P3540](https://www.luogu.com.cn/problem/P3540):::info[sol][here](https://www.luogu.com.cn/article/kgezpl3y).:::+ [P10644](https://www.luogu.com.cn/problem/P10644)待补。16 行未改动+ [CF1515F](https://www.luogu.com.cn/problem/CF1515F)待补。+ [P14942](https://www.luogu.com.cn/problem/P14942)待补。10 行未改动待补。## 图论+ [CF888G](https://www.luogu.com.cn/problem/CF888G)待补。### 反图+ [P3452](https://www.luogu.com.cn/problem/P3452)172 行未改动全部展开因此就成了 $O(V^3\log t+ mV^2\log t)$。:::+ [P17024](https://www.luogu.com.cn/problem/P17024)待补。+ [P15793](https://www.luogu.com.cn/problem/P15793):::info[sol]要使第 $i$ 个花灵不被接触,那么就要增加 $\text{\textcolor{#66CCFF}{1}}$ 接触到其它花灵的次数。所以 $i$ 放到最后肯定更优。邻项交换,发现前面的顺序不会改变 $\text{\textcolor{#66CCFF}{1}}$ 每种接触到其它花灵次数的期望。所以先转移完 $n$ 个,每次要算 $i$ 时再退背包退掉 $i$。:::12345678910111213141516171819202122232424 行未改动49505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111222 行未改动1351361371381391401411421431441451462 行未改动14915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926016 行未改动27727827928028128228328428528628728810 行未改动299300301302303304305306307308309310311312313314315316317318319320321322172 行未改动全部展开495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535施工中!/fendou## 数学+ [P10532](https://www.luogu.com.cn/problem/P10532):::info[sol]诈骗题,,其实就是数了 $(i,j)$ 使得 $1 \le i,j \le n \land i,j \in\mathbb{Z}$,输出 $n^2$。:::+ [P13635](https://www.luogu.com.cn/problem/P13635):::info[sol]注意到 $\gcd(a,b)=\gcd(a,b-a)$。所以是对称的。做一做就好了。:::+ [P15251](https://www.luogu.com.cn/problem/P15251):::info[sol]24 行未改动+ [P6624](https://www.luogu.com.cn/problem/P6624)待补。+ [P14582](https://www.luogu.com.cn/problem/P14582)待补。+ [P11918](https://www.luogu.com.cn/problem/P11918):::info[sol]首先按 $p_i$ 排序,选的一定是一段前缀作答。设 $dp_{i,j}$ 为前 $i$ 题得 $j$ 分的概率,暴力转移,$<\varepsilon$ 的项直接舍去,精细实现即可通过。证明的话…这就是为什么分在数论里而且是黑了。:::+ [P9401](https://www.luogu.com.cn/problem/P9401)待补。+ [P16368](https://www.luogu.com.cn/problem/P16368)待补。+ [P15632](https://www.luogu.com.cn/problem/P15632)待补。+ [P5655](https://www.luogu.com.cn/problem/P5655):::info[sol]有一个[博客](https://www.cnblogs.com/Cry-For-theMoon/p/18426320)。:::## 贪心+ [P8775](https://www.luogu.com.cn/problem/P8775)待补。+ [P10238](https://www.luogu.com.cn/problem/P10238)待补。+ [P2102](https://www.luogu.com.cn/problem/P2102)待补。+ [P7974](https://www.luogu.com.cn/problem/P7974)待补。+ [P14835](https://www.luogu.com.cn/problem/P14835)待补。+ [P14015](https://www.luogu.com.cn/problem/P14015):::info[sol]22 行未改动+ [CF1260E](https://www.luogu.com.cn/problem/CF1260E)待补。+ [P12504](https://www.luogu.com.cn/problem/P12504)待补。### 反悔贪心+ [P16279](https://www.luogu.com.cn/problem/P16279)2 行未改动+ [P3045](https://www.luogu.com.cn/problem/P3045)待补。+ [CF730I](https://www.luogu.com.cn/problem/CF730I)/[AT_agc018_c](https://www.luogu.com.cn/problem/AT_agc018_c)待补。放个代码。:::info[代码]```cpp#include<bits/stdc++.h>#define i128 __int128#define ll long long#define ull unsigned long long#define db double#define ldb long double#define Pii pair<int,int>#define fi first#define se second#define f(x,y) fixed<<setprecision(y)<<x#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,rp,stdin),p1==p2)?EOF:*p1++)using namespace std;const int N=3e4+10;const int inf=1.01e9;const int rp=1e6+10;int n,x,y,fr[N],a[N],b[N],p[N]; ll ans;priority_queue<Pii> q1,q2,q3;char buf[rp],*p1=buf,*p2=buf;inline int read(){int x=0,f=1; char c=0;while(!isdigit(c)) {if(c=='-') f=-1; c=gc();}while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=gc();return x*f;}inline char read_ch(){char c=0;while((!isalpha(c))&&(!isdigit(c))) c=gc();return c;}inline int ge(priority_queue<Pii> &q){return q.empty()?-inf:q.top().fi;}signed main(){cin.tie(0)->sync_with_stdio(0);n=read(); x=read(); y=read(); int u,v,w;for(int i=1;i<=n;++i){u=read(); v=read(); w=read();ans+=w; a[i]=u-w; b[i]=v-w; p[i]=i;}sort(p+1,p+n+1,[](int q,int w){return a[q]>a[w];});for(int i=1;i<=x;++i){fr[p[i]]=1; ans+=a[p[i]];q1.push({b[p[i]]-a[p[i]],p[i]});}for(int i=x+1;i<=n;++i)q2.push({a[p[i]],p[i]}),q3.push({b[p[i]],p[i]});while(y--){while((!q1.empty())&&fr[q1.top().se]!=1) q1.pop();while((!q2.empty())&&fr[q2.top().se]) q2.pop();while((!q3.empty())&&fr[q3.top().se]) q3.pop();int v1=ge(q1)+ge(q2),v2=ge(q3); ans+=max(v1,v2);if(v1>v2){fr[q1.top().se]=2; fr[q2.top().se]=1;q1.push({b[q2.top().se]-a[q2.top().se],q2.top().se});}else fr[q3.top().se]=2;}cout<<ans;return 0;}```:::## 构造+ [P3540](https://www.luogu.com.cn/problem/P3540):::info[sol][here](https://www.luogu.com.cn/article/kgezpl3y).:::+ [P17338](https://www.luogu.com.cn/problem/P17338)待补。+ [P10297](https://www.luogu.com.cn/problem/P10297)待补。+ [P10644](https://www.luogu.com.cn/problem/P10644)待补。16 行未改动+ [CF1515F](https://www.luogu.com.cn/problem/CF1515F)待补。+ [P17333](https://www.luogu.com.cn/problem/P17333)待补。+ [P14942](https://www.luogu.com.cn/problem/P14942)待补。10 行未改动待补。## 图论+ [P2582](https://www.luogu.com.cn/problem/P2582)待补。+ [CF888G](https://www.luogu.com.cn/problem/CF888G)待补。+ [P7984](https://www.luogu.com.cn/problem/P7984)待补。+ [P4366](https://www.luogu.com.cn/problem/P4366)待补。### 反图+ [P3452](https://www.luogu.com.cn/problem/P3452)172 行未改动全部展开因此就成了 $O(V^3\log t+ mV^2\log t)$。:::+ [P7913](https://www.luogu.com.cn/problem/P7913):::info[sol][here.](https://www.luogu.com.cn/article/h8r7mrvj):::+ [P15793](https://www.luogu.com.cn/problem/P15793):::info[sol]要使第 $i$ 个花灵不被接触,那么就要增加 $\text{\textcolor{#66CCFF}{1}}$ 接触到其它花灵的次数。所以 $i$ 放到最后肯定更优。邻项交换,发现前面的顺序不会改变 $\text{\textcolor{#66CCFF}{1}}$ 每种接触到其它花灵次数的期望。所以先转移完 $n$ 个,每次要算 $i$ 时再退背包退掉 $i$。:::+ [P8108](https://www.luogu.com.cn/problem/P8108):::info[sol]考虑相邻两列,可以选出一个公共子序列使得这部分两边一次消除。那么总的答案就是 $n^2$ 减相邻两列最长公共子序列长度之和。由于数据随机生成枚举配对再树状数组是对的。:::+ [P17024](https://www.luogu.com.cn/problem/P17024)待补。+ [()P9035](http://10.10.255.150/p/P9035)待补。