版本比较
题解:P17834 [CSP-S 2026] 研发基地 / hub(民间数据)
正文
增加 23 行删除 21 行
42 行未改动434445464748495051525354555657585960616263646566676832 行未改动10110210310410510610710810911011111211311423 行未改动13813914014114242 行未改动}inline node operator +(const int &o) const{return {x+o,c};}};inline node operator *(node a,node b){if(a.c<b.c) swap(a,b);if(!a.c&&!b.c){int x=max(a.x,b.x);if(x==lim) return {0,1};else return {x,0};}else if(a.c&&!b.c){int x=a.x+b.x;if(x<=lim) return a;int y=x-lim;return {max(a.x-y,0),a.c+b.c+y};}else{return {0,a.c+b.c+a.x+b.x-1};}cerr<<"???\n";return a;}node f[N],h[N];void dfs1(int u){f[u]={0,0};for(int v:g[u]){32 行未改动}#define gc getchar_unlocked//#define gc getcharinline int read(){int f=1,x=0;char ch=gc();while(ch<'0'&&ch>'9'&&ch!='-') ch=gc();if(ch=='-') f=-1,ch=gc();while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=gc();return x*f;}void sol(){for(int i=1;i<=n;i++) g[i].clear();n=read(),m=read();23 行未改动return 0;}```42 行未改动434445464748495051525354555657585960616263646566676832 行未改动10110210310410510610710810911011111211323 行未改动13713813914014114214314442 行未改动}inline node operator +(const int &o) const{return {x+o,c};}inline node operator *(const node &o) const{if(!c&&!o.c){int y=max(x,o.x);if(y==lim) return {0,1};return {y,0};}int y=x+o.x;if(c&&!o.c){if(y<=lim) return {x,c};return {max(x-(y-lim),0),c+y-lim};}if(!c&&o.c){if(y<=lim) return {o.x,o.c};return {max(o.x-(y-lim),0),o.c+y-lim};}return {0,c+o.c+y-1};}};node f[N],h[N];void dfs1(int u){f[u]={0,0};for(int v:g[u]){32 行未改动}#define gc getchar_unlocked//#define gc getcharinline int read(){int x=0;char ch=gc();while(ch<'0'||ch>'9') ch=gc();while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=gc();return x;}void sol(){for(int i=1;i<=n;i++) g[i].clear();n=read(),m=read();23 行未改动return 0;}```