QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401722 | #7617. Spectacle | Andeviking | TL | 0ms | 3648kb | C++20 | 954b | 2024-04-29 11:00:20 | 2024-04-29 11:00:21 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define range(x) (x).begin(),(x).end()
const int dir[][2]={1,0,-1,0,0,1,0,-1};
void solve()
{
int n;
cin>>n;
vector<ll>v(n);
for(auto& c:v)
cin>>c;
sort(range(v));
for(int k=1;k<=n/2;++k){
ll l=0,r=1E18;
while(l<r){
ll mid=(l+r)>>1;
int last=-1;
int cnt=0;
for(int i=1;i<n;++i)
if(v[i]-v[i-1]<=mid&&last!=i-1){
last=i;
cnt++;
}
if(cnt>=k)
r=mid;
else
l=mid+1;
}
cout<<l<<' ';
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3488kb
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: 3648kb
input:
2 1 1000000000000000000
output:
999999999999999999
result:
ok single line: '999999999999999999 '
Test #3:
score: -100
Time Limit Exceeded
input:
200000 30977570544127554 30977570529630987 30977570554040634 30977570903666181 30977570284338326 30977570675313216 30977569987827221 30977570780807305 30977570623822067 30977570207823010 30977569932624714 30977570440962037 30977570343703869 30977570239637322 30977570141845422 30977570372368100 30977...