版本比较
题解 P9168 [省选联考 2023] 人员调度
正文
增加 7 行删除 7 行
130 行未改动全部展开13113213313413513513613713813982 行未改动2222232242252262262272282292302312322332342352352362372382396 行未改动24624724824925025025125225325425525525625725825926026126126226326426518 行未改动28428528628728828828929029129254 行未改动130 行未改动全部展开}}
namespace DS2{
namespace Sgt{struct Node{ int tag,mn; Node(){tag=0;mn=inf;}82 行未改动 re Sgt::get(1,1,n,dfn[y],dfn[x]); } re 0;}} }
namespace Company{struct Roll{ int id,loser;}stk[N<<1];int top;ll ans;
void hello_world(int id){//正式步入职业生涯 void hello_world(int id){//正式步入职业生涯 //Hello, world!// printf("hello_world(%d)!\n",id); ans+=a[id].v; DS1::ins(id);6 行未改动 DS1::del(id); DS2::upd(a[id].x,1);}
bool gao(int id){//把员工 id 加进来 bool gao(int id){//把员工 id 加进来// printf("gao(%d)\n",id); int t=DS2::ask(a[id].x); if(!t){ ++top; stk[top].id=id,stk[top].loser=0;//岗位充足,没有产生下岗员工 stk[top].id=id,stk[top].loser=0;//岗位充足,没有产生下岗员工 hello_world(id); re 1; } //很遗憾,零和博弈,必定有输家 int me=DS1::ask(1,1,n,dfn[t],dfn[t]+siz[t]-1);//末位淘汰 if(a[me]<a[id]){//内卷斗兽场 if(a[me]<a[id]){//内卷斗兽场 ++top; stk[top].id=id,stk[top].loser=me; hello_world(id); say_goodbye(me);18 行未改动 tr[x].pb(id); re; } if(L<=mid) push(ls,l,mid,L,R,id); if(R>mid) push(rs,mid+1,r,L,R,id); if(R>mid) push(rs,mid+1,r,L,R,id);}void dfs(int x,int l,int r){// printf("dfs(%d,%d,%d)\n",x,l,r); int ct=0;54 行未改动