Hdu 1025 - Constructing Roads In JGShining's Kingdom
用二分查找,不知为何一直RE,数组明明开的足够了。RE代码:#includeintnum[500001];intans[500001];intmain(){intn,k=1,len,p,r,i;intlow,mid,high;while(scanf("%d",&n)!=EOF){for(i=0;i=num[i])high=mid-1;elselow=mid+1;}ans[low]=num[i];i