QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#227705 | #7617. Spectacle | ucup-team2230# | WA | 0ms | 3692kb | C++14 | 1.2kb | 2023-10-27 21:40:07 | 2023-10-27 21:40:08 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
#define eb emplace_back
using ll=long long;
using PL=pair<ll,int>;
using P=pair<int,int>;
#define tct template<class t>
#define tctu template<class t,class u>
tct using vc=vector<t>;
tctu bool chmax(t&a,u b){if(a<b){a=b;return 1;}return 0;}
tctu bool chmin(t&a,u b){if(a>b){a=b;return 1;}return 0;}
void solve(){
int n;
scanf("%d",&n);
vc<ll> A(n);
for(int i=0;i<n;i++){
cin>>A[i];
}
sort(A.begin(),A.end());
vc<PL> idx(n-1);
for(int i=0;i+1<n;i++) idx[i]=PL(A[i+1]-A[i],i);
sort(idx.begin(),idx.end());
set<P> st;
set<P>::iterator it;
for(int i=0;i<n;i++) st.insert(P(i,i));
int cnt=0;
vc<ll> ans(n/2+1,idx[n-2].a);
for(int i=0;i<n-1;i++){
int v=idx[i].b;
it=st.lower_bound(P(v+1,v+1));
P p=*it;
cnt-=(p.b-p.a+1)/2;
int r=p.b;
it--;
P q=*it;
cnt-=(q.b-q.a+1)/2;
int l=q.a;
st.erase(p);
st.erase(q);
cnt+=(r-l+1)/2;
st.insert(P(l,r));
ans[cnt]=min(ans[cnt],idx[i].a);
}
for(int i=n/2-1;i>=1;i--) ans[i]=min(ans[i],ans[i+1]);
for(int i=1;i<=n/2;i++) cout<<ans[i]<<" ";
cout<<endl;
}
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
cout<<fixed<<setprecision(20);
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3692kb
input:
6 100 13 20 14 10 105
output:
0 0 0
result:
wrong answer 1st lines differ - expected: '1 5 6', found: '0 0 0 '