QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#224758#7617. Spectacleucup-team004#RE 1ms3448kbC++20939b2023-10-23 13:41:462023-10-23 13:41:47

Judging History

你现在查看的是最新测评结果

  • [2023-10-23 13:41:47]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3448kb
  • [2023-10-23 13:41:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
const int N=100005;
const ll inf=1e18;
int t,n;
ll a[N],ans[N];
void solve(int l,int r,ll L,ll R){
    if(l>r)return;
    if(L==R){
        For(i,l,r)ans[i]=L; return;
    }
    ll mid=(L+R)>>1;
    int cnt=0;
    For(i,1,n-1){
        if(a[i+1]-a[i]<=mid){
            cnt++; i++;
        }
    }
    solve(l,cnt,L,mid);
    solve(cnt+1,r,mid+1,R);
}
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    t=1;
    while(t--){
        cin>>n;
        For(i,1,n){
            cin>>a[i];
        }
        sort(a+1,a+n+1);
        /*int l=0,r=n-1;
        while(l<r){
            int mid=(l+r)>>1; mid++;
            if(check(mid))l=mid; else r=mid-1;
        }
        cout<<n-l<<endl;*/
        solve(1,n/2,0,inf);
        For(i,1,n/2)cout<<ans[i]<<(i<n/2?' ':'\n');
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3444kb

input:

6
100 13 20 14 10 105

output:

1 5 6

result:

ok single line: '1 5 6'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3448kb

input:

2
1 1000000000000000000

output:

999999999999999999

result:

ok single line: '999999999999999999'

Test #3:

score: -100
Runtime Error

input:

200000
30977570544127554 30977570529630987 30977570554040634 30977570903666181 30977570284338326 30977570675313216 30977569987827221 30977570780807305 30977570623822067 30977570207823010 30977569932624714 30977570440962037 30977570343703869 30977570239637322 30977570141845422 30977570372368100 30977...

output:


result: