QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#224758 | #7617. Spectacle | ucup-team004# | RE | 1ms | 3448kb | C++20 | 939b | 2023-10-23 13:41:46 | 2023-10-23 13:41:47 |
Judging History
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...