帮忙调一下错
查看原帖
帮忙调一下错
422110
HgSO4qwq楼主2021/5/7 18:27
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[2*n];
    for(int i=0;i<2*n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    long long fir=0,las=0;
    for(int i=0;i<n;i++)
    {
        fir+=a[i];
        las+=a[2*n-1-i];
    }
    if(fir!=las)
    {
        for(int i=0;i<2*n;i++)
        {
            cout<<a[i]<<' ';
        }
    }
    else
    {
        cout<<-1;
    }
    return 0;
}

11

Time: 00 ms, memory: 37843784 KB

Verdict: WRONG_ANSWER

Input

33

1 2 2 1 3 11\ 2\ 2\ 1\ 3\ 1

Participant's output

1-1

Jury's answer

2 1 3 1 1 22\ 1\ 3\ 1\ 1\ 2

Checker comment

Wrong answer the jury found an answer while the participant couldn't.

2021/5/7 18:27
加载中...