版本比较
石门集训笔记
正文
增加 30 行删除 30 行
36 行未改动3738394041414243444548 行未改动9495969798989910010110212 行未改动115116117118119119120121122123131 行未改动全部展开25525625725825925926026126226313 行未改动27727827928028128128228328428532 行未改动31831932032132232232332432532624 行未改动35135235335435535535635735835927 行未改动38738838939039139139239339439522 行未改动4184194204214224224234244244254264274287 行未改动43643743843944044044144244344457 行未改动50250350450550650650750850850951051151224 行未改动5375385395405415415425435445456 行未改动55255355455555655655755855956022 行未改动5835845855865875875885895895905915925937 行未改动60160260360460560560660760860944 行未改动65465565665765865865966066166222 行未改动6856866876886896896906916916926936946957 行未改动70370470570670770770870971071162 行未改动7747757767777787787797807817822 行未改动78578678778878978979079179279342 行未改动83683783883984084184084184284384484514 行未改动8608618628638648648658668668678688698703 行未改动87487587687787887887988088188236 行未改动91992092192292392392492592692736 行未改动 fa[y]=x;fa[x]=z; if(z)ch[z][y==ch[z][1]]=x; maintain(y); maintain(x); } }```
3. Splay操作
48 行未改动```cppint rk(int x){ int res=0,cur=rt; while(1){
if(x<val[cur])cur=ch[cur][0]; else{ res+=size[ch[cur][0]]; if(!cur)return res+1;12 行未改动```cppint kth(int x){ int cur=rt; while(1){
if(ch[cur][0]&&x<=size[ch[cur][0]])cur=ch[cur][0]; else{ x-=size[ch[cur][0]]+same[cur]; if(x<=0){131 行未改动全部展开 hn[++tot].a=h[i].a; hn[tot].b=h[i].b; hn[tot].c=h[i].c; hn[tot].cnt=m;
m=0; } } CDQ(1,tot);13 行未改动int ask[N],matched[N];bool found(int u){ for(int i=1;i<=m;i++){ if(G[u][i]){
if(ask[i])continue; ask[i]=1; if(!matched[i]||found(matched[i])){ matched[i]=u;32 行未改动const int N=1e6+5;const int inf=1e9+5;struct node{ long long w; int to,next; int to,next;}e[N];int n,m,s,t,tot=1;long long head[N],dis[N],pre[N],ans;bool vis[N];24 行未改动 q.push(e[i].to); vis[e[i].to]=1; if(e[i].to==t)return 1; }
} return 0;}void update(){27 行未改动const int N=1e6+5;const int inf=1e9+5;struct node{ long long w; int to,next; int to,next;}e[N];int n,m,s,t,tot=1;long long head[N],dis[N],pre[N],ans,cur[N];bool vis[N];22 行未改动 dis[e[i].to]=dis[x]+1; q.push(e[i].to); if(e[i].to==t)return true; }
}
} return 0;}int dfs(int now,int t,long long flow){7 行未改动 // if(!tmp)dis[e[i].to]=0; if(tmp){ e[i].w-=tmp; e[i^1].w+=tmp;
used+=tmp; if(flow-used==0)return flow; } }57 行未改动 dis[e[i].to]=dis[x]+e[i].cost; if(!vis[e[i].to])q.push(e[i].to),vis[e[i].to]=1; //if(e[i].to==t)return true; }
}
} return dis[t]!=inf;}
24 行未改动 while(bfs()){ //for(int i=1;i<=n;i++)cout<<dis[i]<<" "; //cout<<endl; ans+=dfs(s,t,inf);
} cout<<ans<<" "<<ret; return 0;}6 行未改动const int N=1e6+5;const int inf=1e9+5;struct node{ long long w; int to,next; int to,next;}e[N];int n,m,s,t,tot=1;long long head[N],dis[N],pre[N],ans,cur[N],h[N];bool vis[N];22 行未改动 dis[e[i].to]=dis[x]+1; q.push(e[i].to); if(e[i].to==t)return true; }
}
} return 0;}int dfs(int now,int t,long long flow){7 行未改动 // if(!tmp)dis[e[i].to]=0; if(tmp){ e[i].w-=tmp; e[i^1].w+=tmp;
used+=tmp; if(flow-used==0)return flow; } }44 行未改动const int N=1e6+5;const int inf=1e9+5;struct node{ long long w; int to,next; int to,next;}e[N];int n,m,s,t,tot=1;long long head[N],dis[N],pre[N],ans,cur[N],h[N];bool vis[N];22 行未改动 dis[e[i].to]=dis[x]+1; q.push(e[i].to); if(e[i].to==t)return true; }
}
} return 0;}int dfs(int now,int t,long long flow){7 行未改动 // if(!tmp)dis[e[i].to]=0; if(tmp){ e[i].w-=tmp; e[i^1].w+=tmp;
used+=tmp; if(flow-used==0)return flow; } }62 行未改动 if(!dfn[to]){ dfs(to); low[u]=min(low[u],low[to]); }else if(vis[to])low[u]=min(low[u],low[to]);
} if(low[u]==dfn[u]){ ++SCC; do{2 行未改动 color[u]=SCC; vis[u]=0; }while(low[u]!=dfn[u]); }
}int main(){ ios::sync_with_stdio(0); cin.tie(0);42 行未改动 for(int i=1;i<=n;i++) for(int j=1;j<=n+1;j++){ cin>>a[i][j]; }
for(int i=1;i<=n;i++){ int now=i; for(int j=i+1;j<=n;j++){ if(fabs(a[j][i])>fabs(a[i][i]))now=j;14 行未改动 a[j][l]=a[j][l]*k-a[i][l]; } } }
cout<<"";
for(int i=1;i<=n;i++){ if(a[i][i]!=1){ if(a[i][i]==0&&a[i][n+1]!=0){ cout<<"No Solution";3 行未改动 if(k!=0)for(int j=1;j<=n+1;j++){ a[i][j]/=k; } }else continue;
} for(int i=1;i<=n;i++){ if(fabs(a[i][n+1])<eps){ cout<<"0.00"<<endl;36 行未改动 long long ansl=0,ansr=0; for(int i=1;i<=n;i++){ ansl^=i*(l[i]+1)*1ll; ansr^=i*(r[i]+1)*1ll; } } cout<<ansl<<" "<<ansr; return 0;}```