• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts


给定一个长度为n .的数组,对于一个值域区间\([x,y]\),如果有一种把原数组分成k个子数组的方法,并且每个子数组中\([x,y]\)中的数严格大于不在\([x,y]\)中的数,则称该值域区间有效。找到最短的范围间隔并输出一个分割方案。

\(1 \阿乐_i\le n\)


如果能截成\(k ^ 1 \)段,那肯定能截成\(k\)段,所以你只需要看你最多能截多少段。

对于某个\([x,y]\),记录\(a_i\in [x,y]\)为\(1\),否则为\(-1\)。那么当一个子段中的数之和为\(\ge 1\)时,这个子段就是合法的。



void sol() {


向量c(n ^ 1,0);

for(int I=1;I=n;i ) cin a,c[a];

int L=0,R=1e9

for(int l=1,r=0,s=0;l=n;l ) {

while(r n(r l | | 2 * s-NK))s=c[r];

如果(2*s-n=k R - L r - l) L=l,R=r



cout L ' ' R endl

for(int l=1,r=1,s=0,K=0;r=n;r ) {

if(K==k-1)返回cout l ' ' n endl,void();

s=a[R]=L a[R]=R;

if(2*s-(r-l 1)==1) K,s=0,cout l ' ' r endl,l=r 1;



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now