正文
增加 3 行删除 3 行
46 行未改动47484950515253545543 行未改动9910010110210310410510610710810911011111211311411511616 行未改动46 行未改动inline void pf(ll x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}const int N =5e5+5,M=5e6+5,inf=(1LL<<31)-1;const ll llf=1e18,mod=1e9+7;using namespace std;int T=read(),k,n,a[N];inline int gcd(int x,int y){if(!x||!y)return x|y;return gcd(y,x%y);}43 行未改动rep(i,Ll,Rr){if(a[i]==1){if(!len)s[++tp]=i,ln[tp]=1,len=1;else len++,ln[tp]++;}else len=0;}priority_queue<node>q;rep(i,1,tp)q.push({s[i],ln[i]});while(!q.empty()){if(!k)break;int x=q.top().x,len=q.top().k;q.pop();rep(i,x,x+len-1){k--;a[i]=0;if(!k)break;16 行未改动46 行未改动47484950515253545543 行未改动9910010110210310410510610710810911011111211311411511616 行未改动46 行未改动inline void pf(ll x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}const int N =5e5+5,M=5e6+5,inf=(1LL<<31)-1;const ll llf=1e18,mod=1e9+7;using namespace std;int T=read(),k,n,a[N];inline int gcd(int x,int y){if(!x||!y)return x|y;return gcd(y,x%y);}43 行未改动rep(i,Ll,Rr){if(a[i]==1){if(!len)s[++tp]=i,ln[tp]=1,len=1;else len++,ln[tp]++;}else len=0;}priority_queue<node>q;rep(i,1,tp)q.push({s[i],ln[i]});while(!q.empty()){if(!k)break;int x=q.top().x,len=q.top().k;q.pop();rep(i,x,x+len-1){k--;a[i]=0;if(!k)break;16 行未改动