QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#228648 | #7617. Spectacle | ucup-team1251# | WA | 43ms | 7068kb | C++20 | 1.3kb | 2023-10-28 13:52:37 | 2023-10-28 13:52:38 |
Judging History
answer
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define endl "\n"
#define S second
#define F first
#define ln cout<<endl;
#define mem(a) memset((a),0,sizeof (a));
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define debug cout<<"here!"<<endl;
ll cnt,n,m,t,ans,ant;
const int N=2e5+10;
const int INF=0x3f3f3f3f;
string str;
void solve()
{
cin>>n;
vector<ll>a(n+1);
for(ll i=1;i<=n;i++) cin>>a[i];
sort(a.begin()+1,a.end());
vector<ll>even,odd;
ans=1e18;
for(ll i=2;i<=n;i+=2)
{
even.push_back(a[i]-a[i-1]);
}
sort(even.begin(),even.end());
for(ll i=3;i<=n;i+=2)
odd.push_back(a[i]-a[i-1]);
sort(odd.begin(),odd.end());
while(odd.size()<even.size()) odd.push_back(1e18);
while(odd.size()>even.size()) even.push_back(1e18);
for(ll i=0;i<n/2;i++)
{
cout<<min(odd[i],even[i])<<' ';
}
return;
}
int main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll _=1;
// cin>>_;
while(_--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
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: 3616kb
input:
2 1 1000000000000000000
output:
999999999999999999
result:
ok single line: '999999999999999999 '
Test #3:
score: -100
Wrong Answer
time: 43ms
memory: 7068kb
input:
200000 30977570544127554 30977570529630987 30977570554040634 30977570903666181 30977570284338326 30977570675313216 30977569987827221 30977570780807305 30977570623822067 30977570207823010 30977569932624714 30977570440962037 30977570343703869 30977570239637322 30977570141845422 30977570372368100 30977...
output:
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 ...
result:
wrong answer 1st lines differ - expected: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...99 9999 10000 10000 10000 10000', found: '0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 ... 10000 10000 10000 10000 10000 '