版本比较
NOIP2026前
正文
增加 528 行删除 2 行
1233456713 行未改动2122232425262728293011 行未改动4243444546474849505110 行未改动62636465666768697071727374757677787924 行未改动10410510610710810911011111211336 行未改动15015115215315415515615715815958 行未改动21821922022122222322422522622784 行未改动312313314315316317318319320321164 行未改动全部展开4864874884894904914924934944954964974984995005015025035045055065075085095105115125132 行未改动51651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074110 行未改动752753754755756757758759760761146 行未改动全部展开908909910911912913914915916917122 行未改动全部展开1040104110421043805104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331## 2026.11.16
考的是洛谷的NOIP模拟赛。洛谷 NOIP 模拟赛。
### T1
[P17877](https://www.luogu.com.cn/problem/P17877)13 行未改动赛后发现乘上区间长度就 AC 了,痛失场蓝。
~~(这坨史有 70pts,lg 拿脚造的数据)~~
dif:5/11
### T2
[P17878](https://www.luogu.com.cn/problem/P17878)
11 行未改动然后要依次讨论删不删 $(u,v)$ 这条边,以及这么做会对子树造成多大的贡献即可。
其余部分见题解。
dif:5.5/11
### T3
[P17879](https://www.luogu.com.cn/problem/P17879)
10 行未改动$$
线段树维护最大的 $dp_i-s_i$。
dif:6.5/11
### T4
[P17880](https://www.luogu.com.cn/problem/P17880)
场上打了 4pts 的暴力。
dif:7.5/11
## 2026.11.17
打的超级烂,建议拿省四。
24 行未改动
完全不会笛卡尔树,布丁。
dif:6/11
### T2

36 行未改动}```::::
dif:4/11
### T3

58 行未改动}```::::
dif:5.5/11
### T4

84 行未改动::::
笑点解析:我正在思考用 cc_hash_table 还是 gp_hash_table 更快的时候,TobyHu 信誓旦旦地和我说 gp_hash_table 更快,结果就他的 gp_hash_table 会 TLE,其他的 map,unordered_map,cc_hash_table 都能过,太不堪了。
dif:3.5/11
## 2026.11.18
自由练习,VP 了 ZR Day 8。
164 行未改动全部展开}```::::
dif:3/11
### ZR3730.百年好合/[P14347](https://www.luogu.com.cn/problem/P14347)
很厉害的题。
[我的题解](https://www.luogu.com.cn/article/8qoo52i2)
dif:6/11
### [P5464](https://www.luogu.com.cn/problem/P5464)
深刻。
你发现这个问题等价于选出若干条线段,使得集合中任意三条线段无交的数量。
树状数组维护即可,复杂度 $O(n^2 \log n)$。
dif:5.5/11
### [P6032](https://www.luogu.com.cn/problem/P6032)
双指针。
2 行未改动这题神了。
没订完。
我草我线段树写错了。
::::info[code]```cpp#include<bits/stdc++.h>#define int long long#define ll long long#define ull unsigned long long#define i128 __int128#ifdef __linux__//#define getchar getchar_unlocked#define putchar putchar_unlocked#endif#define CK_TM cerr<<'\n'<<1.0*fabs(&ENDM-&STARTM)/(1024*1024)<<"MB"<<" "<<1.0*clock()/CLOCKS_PER_SEC*1000<<"ms"<<'\n';char buf[1<<25],*p1,*p2;#define getchar() ((p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<25,stdin))?EOF:*p1++)#define vector basic_string#define pq priority_queue#define mkpr make_pair#define pii pair<int,int>#define pb push_back#define umap unordered_map#define uset unordered_set#define vi vector<int>#define sz(h) (int)h.size()#define popc(x) __builtin_popcount(x)bool STARTM;constexpr double eps=1e-10;constexpr int i_inf=1e9;constexpr ll ll_inf=1e18;namespace AyanamiRei{ inline int read(){ int x=0,f=1;char c=getchar(); while(c<'0'||c>'9') {if(c=='-') f^=1;c=getchar();} while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();} return f?x:~x+1; }}namespace SoryuAsukaRangure{ inline void write(int x){ if(x<0) x=~x+1,putchar('-'); if(x>9) write(x/10); return putchar(x%10^48),void(); }}namespace AyanamiYue{ inline void spaceput(int x){ SoryuAsukaRangure::write(x);putchar(' '); }}namespace IkariYue{ inline void output(int x){ SoryuAsukaRangure::write(x);putchar('\n'); }}namespace IkariShinji{ inline int max(int x,int y){ return x>y?x:y; }}namespace NagisaKaworu{ inline int min(int x,int y){ return x<y?x:y; }}namespace MariMakinamiIllustious{ inline double MAX(double x,double y){ return x-y>eps?x:y; }}namespace ShikinamiAsukaRangure{ inline double MIN(double x,double y){ return y-x>eps?x:y; }}using namespace std;using namespace AyanamiRei;using namespace SoryuAsukaRangure;using namespace AyanamiYue;using namespace IkariYue;using namespace IkariShinji;using namespace NagisaKaworu;using namespace MariMakinamiIllustious;using namespace ShikinamiAsukaRangure;constexpr int N=6e5+5; constexpr int the_birthday_of_Asuka=20011204;constexpr int the_birthday_of_Ayanami=20010330;mt19937 Asuka(the_birthday_of_Asuka+time(0));mt19937 Ayanami(the_birthday_of_Ayanami+time(0)); int n,sum,tot,L;int ans[N<<1],rk[N],head[N],nxt[N];vi eva[N];set<int> s;inline int manosaba(int Ema,int Hiro){ return rk[Ema]<rk[Hiro];}struct smt{ pii mx; int ct,lazy;}tree[N<<2];namespace SMT{ inline void pushup(int x){ tree[x].ct=tree[x<<1].ct+tree[x<<1|1].ct; tree[x].mx=std::max(tree[x<<1].mx,tree[x<<1|1].mx); } inline void pushdown(int x){ if(tree[x].lazy){ tree[x<<1].mx.first+=tree[x].lazy; tree[x<<1|1].mx.first+=tree[x].lazy; tree[x<<1].lazy+=tree[x].lazy; tree[x<<1|1].lazy+=tree[x].lazy; tree[x].lazy=0; } } inline void build(int x,int l,int r){ if(l==r) return tree[x].mx=mkpr(-i_inf,l),void(); int mid=(l+r)>>1; build(x<<1,l,mid),build(x<<1|1,mid+1,r); pushup(x); } inline void update(int x,int p,int v,int c,int l,int r){ if(l==r){ tree[x].mx.first=v,tree[x].ct=c; return; } int mid=(l+r)>>1;pushdown(x); if(p<=mid) update(x<<1,p,v,c,l,mid); else update(x<<1|1,p,v,c,mid+1,r); pushup(x); } inline void add(int x,int v,int L,int R,int l,int r){ if(L>r||l>R) return; if(L<=l&&r<=R){ tree[x].lazy+=v,tree[x].mx.first+=v; return; } int mid=(l+r)>>1;pushdown(x); if(L<=mid) add(x<<1,v,L,R,l,mid); if(mid<R) add(x<<1|1,v,L,R,mid+1,r); pushup(x); } inline int query(int x,int L,int R,int l,int r){ if(L>r||l>R||L>R) return 0; if(L<=l&&r<=R) return tree[x].ct; int mid=(l+r)>>1,res=0;pushdown(x); if(L<=mid) res+=query(x<<1,L,R,l,mid); if(mid<R) res+=query(x<<1|1,L,R,mid+1,r); return res; }}namespace SET{ inline void rebuild(int v){ SMT::add(1,1,1,v-1,1,tot); SMT::update(1,v,SMT::query(1,v+1,sum,1,tot)+head[v],1,1,tot); s.insert(v); } inline void sword(int v){ SMT::add(1,-1,1,v-1,1,tot); SMT::update(1,v,-i_inf,0,1,tot); s.erase(v); } inline int check(int v){ if(s.empty()) return 1; pii cur=tree[1].mx; int lim=cur.first,g8c=cur.second,now=lim; if(lim>v) return 0; vi del; while(1){ int f=*s.rbegin(); sword(f),del.pb(f); ans[now--]=1; if(f==g8c) break; } if(nxt[g8c]) rebuild(nxt[g8c]); if(check(now)) return 1; if(nxt[g8c]) sword(nxt[g8c]); if(lim==v){ for(int i=now+1;i<=lim;i++) ans[i]=0; for(int e:del) rebuild(e); return 0; } ans[lim+1]=1,ans[now+1]=0; return check(now+1); }}bool ENDM;signed main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ string w;cin>>w;reverse(w.begin(),w.end()); int len=w.length();L=max(L,len);w=" "+w; for(int j=1;j<=len;j++){ if(w[j]=='1') eva[j].pb(i),sum++; } } for(int i=1;i<=L;i++){ sort(eva[i].begin(),eva[i].end(),manosaba); for(int v:eva[i]){ tot++; nxt[tot]=rk[v];rk[v]=tot;head[tot]=i-1; } } SMT::build(1,1,tot); for(int i=1;i<=n;i++) SET::rebuild(rk[i]); SET::check(n+L);int flag=1; for(int i=L+n;i>=0;i--){ if(ans[i]) write(ans[i]),flag=0; else if(!flag) write(ans[i]); } CK_TM; return 0;}```::::
dif:8.5/11
### ZR3731.墨山/[P14382](https://www.luogu.com.cn/problem/P14382)
不是题。
dif:7.5/11
## 2026.11.19
ZR Day 18
10 行未改动
感觉 *2300 左右吧,有点要脑子。
dif:5.5/11
::::info[code]```cpp#include<bits/stdc++.h>#define int long long146 行未改动全部展开```
我真的觉得这个 $p$ 数组和 $nxt$ 数组的定义非常巧妙,这样就可以把这道题转化为一个分讨数学题了。
dif:6.5/11
::::info[code]```cpp#include<bits/stdc++.h>#define int long long122 行未改动全部展开

[叉姐](https://www.luogu.com.cn/user/22682)的题,太厉害了的题,吓哭了。
最难的就是这个导出子图的分析,不过这题对于拼好分和观察性质的训练是很好的。
但是题解不像人。
dif:7.25/11
::::info[code]```cpp#include<bits/stdc++.h>#define int long long#define ll long long#define ull unsigned long long#define i128 __int128#ifdef __linux__//#define getchar getchar_unlocked#define putchar putchar_unlocked#endif#define CK_TM cerr<<'\n'<<1.0*fabs(&ENDM-&STARTM)/(1024*1024)<<"MB"<<" "<<1.0*clock()/CLOCKS_PER_SEC*1000<<"ms"<<'\n';char buf[1<<25],*p1,*p2;#define getchar() ((p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<25,stdin))?EOF:*p1++)#define vector basic_string#define pq priority_queue#define mkpr make_pair#define pii pair<int,int>#define pb push_back#define umap unordered_map#define uset unordered_set#define vi vector<int>#define sz(h) (int)h.size()#define popc(x) __builtin_popcount(x)bool STARTM;constexpr double eps=1e-10;constexpr int i_inf=1e9;constexpr ll ll_inf=1e18;namespace AyanamiRei{ inline int read(){ int x=0,f=1;char c=getchar(); while(c<'0'||c>'9') {if(c=='-') f^=1;c=getchar();} while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();} return f?x:~x+1; }}namespace SoryuAsukaRangure{ inline void write(int x){ if(x<0) x=~x+1,putchar('-'); if(x>9) write(x/10); return putchar(x%10^48),void(); }}namespace AyanamiYue{ inline void spaceput(int x){ SoryuAsukaRangure::write(x);putchar(' '); }}namespace IkariYue{ inline void output(int x){ SoryuAsukaRangure::write(x);putchar('\n'); }}namespace IkariShinji{ inline int max(int x,int y){ return x>y?x:y; }}namespace NagisaKaworu{ inline int min(int x,int y){ return x<y?x:y; }}namespace MariMakinamiIllustious{ inline double MAX(double x,double y){ return x-y>eps?x:y; }}namespace ShikinamiAsukaRangure{ inline double MIN(double x,double y){ return y-x>eps?x:y; }}using namespace std;using namespace AyanamiRei;using namespace SoryuAsukaRangure;using namespace AyanamiYue;using namespace IkariYue;using namespace IkariShinji;using namespace NagisaKaworu;using namespace MariMakinamiIllustious;using namespace ShikinamiAsukaRangure;constexpr int N=1e3+6e2+5;constexpr int the_birthday_of_Asuka=20011204;constexpr int the_birthday_of_Ayanami=20010330;mt19937 Asuka(the_birthday_of_Asuka+time(0));mt19937 Ayanami(the_birthday_of_Ayanami+time(0));int Case,n,m,ans;int S[10],F[10]={0,2,12,6,24,48,36,12,12,24},a[N],b[N];bitset<N> vis[N];inline int C2(int x){ return x*(x-1)/2;}inline int C3(int x){ return x*(x-1)*(x-2)/6;}bool ENDM;signed main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); cin>>Case>>n; for(int i=1;i<=n;i++){ string s;cin>>s;s=" "+s; for(int j=1;j<=n;j++){ if(s[j]=='1') S[1]++,vis[i].set(j); } } for(int i=1;i<=n;i++){ int v1=vis[i].count(); S[2]+=C2(v1),S[7]+=C3(v1); for(int j=1;j<=n;j++){ if(i==j) continue; int v2=vis[j].count(),v3=(vis[i]&vis[j]).count(); if(vis[i][j]) S[3]+=(v1-1)*(v2-1)-v3,S[4]+=v3,S[6]+=C2(v3),a[i]+=v3,b[i]+=C2(v3); S[5]+=C2(v3),S[8]+=C2(v3)*(v1-2-vis[i][j]); } } for(int i=1;i<=n;i++) S[9]+=a[i]/2*(a[i]/2-1)/2-b[i]; S[1]/=2,S[3]/=2,S[4]/=6,S[5]/=4,S[6]/=2; for(int i=1;i<=9;i++) ans+=F[i]*S[i]; write(ans); CK_TM; return 0;}```::::
### T4
[原题](https://qoj.ac/problem/7309)




依旧是[叉姐](https://www.luogu.com.cn/user/22682)的题。
原来的 $O(nm \log L)$ 很难写,但你发现这题正睿上开了 2s,且 $n,m,L \le 10^3$。
然后就学习了一个非常暴力的 $O(nmL)$ 做法。
::::info[code]```cpp#include<bits/stdc++.h>#include <ext/pb_ds/assoc_container.hpp>#include <ext/pb_ds/priority_queue.hpp>#include <ext/pb_ds/exception.hpp>#include <ext/pb_ds/hash_policy.hpp>#include <ext/pb_ds/list_update_policy.hpp>#include <ext/pb_ds/tree_policy.hpp>#include <ext/pb_ds/trie_policy.hpp>#define int long long#define ll long long#define ull unsigned long long#define i128 __int128#ifdef __linux__//#define getchar getchar_unlocked#define putchar putchar_unlocked#endif#define CK_TM cerr<<'\n'<<1.0*fabs(&ENDM-&STARTM)/(1024*1024)<<"MB"<<" "<<1.0*clock()/CLOCKS_PER_SEC*1000<<"ms"<<'\n';char buf[1<<25],*p1,*p2;#define getchar() ((p1==p2)&&(p2=(p1=buf)+fread(buf,1,1<<25,stdin))?EOF:*p1++)#define vector basic_string#define pq priority_queue#define mkpr make_pair#define pii pair<int,int>#define pb push_back#define umap unordered_map#define uset unordered_set#define vi vector<int>#define sz(h) (int)h.size()#define popc(x) __builtin_popcount(x)bool STARTM;constexpr double eps=1e-10;constexpr int i_inf=1e9;constexpr ll ll_inf=1e18;namespace AyanamiRei{ inline int read(){ int x=0,f=1;char c=getchar(); while(c<'0'||c>'9') {if(c=='-') f^=1;c=getchar();} while(c>='0'&&c<='9') {x=(x<<3)+(x<<1)+(c^48);c=getchar();} return f?x:~x+1; }}namespace SoryuAsukaRangure{ inline void write(int x){ if(x<0) x=~x+1,putchar('-'); if(x>9) write(x/10); return putchar(x%10^48),void(); }}namespace AyanamiYue{ inline void spaceput(int x){ SoryuAsukaRangure::write(x);putchar(' '); }}namespace IkariYue{ inline void output(int x){ SoryuAsukaRangure::write(x);putchar('\n'); }}namespace IkariShinji{ inline int max(int x,int y){ return x>y?x:y; }}namespace NagisaKaworu{ inline int min(int x,int y){ return x<y?x:y; }}namespace MariMakinamiIllustious{ inline double MAX(double x,double y){ return x-y>eps?x:y; }}namespace ShikinamiAsukaRangure{ inline double MIN(double x,double y){ return y-x>eps?x:y; }}using namespace std;using namespace AyanamiRei;using namespace SoryuAsukaRangure;using namespace AyanamiYue;using namespace IkariYue;using namespace IkariShinji;using namespace NagisaKaworu;using namespace MariMakinamiIllustious;using namespace ShikinamiAsukaRangure;using namespace __gnu_pbds;constexpr int N=2e3+5;constexpr int the_birthday_of_Asuka=20011204;constexpr int the_birthday_of_Ayanami=20010330;mt19937 Asuka(the_birthday_of_Asuka+time(0));mt19937 Ayanami(the_birthday_of_Ayanami+time(0));int Case,T,n,m;cc_hash_table<int,int> mp;int a[N],b[N],p[N],q[N],sa[N],sb[N],dp[N][N];bool ENDM;signed main(){ Case=read(),T=read(); while(T--){ n=read(),m=read(); mp.clear(); for(int i=1;i<=n;i++){ a[i]=read(),p[i]=read(); sa[i]=mp[a[i]];mp[a[i]]=i; } mp.clear(); for(int i=1;i<=m;i++){ b[i]=read(),q[i]=read(); sb[i]=mp[b[i]];mp[b[i]]=i; } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ dp[i][j]=max(dp[i-1][j],dp[i][j-1]); if(a[i]!=b[j]) continue; int A=i,B=j,l=0,r=0; while(A){ l+=p[A]; while(B){ r+=q[B]; dp[i][j]=max(dp[i][j],dp[A-1][B-1]+min(l,r)); if(r>l){ r-=q[B];break; } B=sb[B]; } A=sa[A]; } } } output(dp[n][m]); for(int i=1;i<=n;i++){ sa[i]=sb[i]=0; for(int j=1;j<=m;j++){ dp[i][j]=0; } } } CK_TM; return 0;}```::::
dif:5/11 $O(nmL)$
dif:(8)? $O(nm \log L)$