QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#800853#8790. First Billionucup-team6015#WA 0ms3892kbC++14824b2024-12-06 16:14:142024-12-06 16:14:15

Judging History

你现在查看的是最新测评结果

  • [2024-12-06 16:14:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3892kb
  • [2024-12-06 16:14:14]
  • 提交

answer

#include <bits/stdc++.h>

std::mt19937 rnd(time(0));

int main()
{
    int n;
    scanf("%d",&n);
    std::vector<int> ori(n),a(n),b(n);
    for(int i=0;i<n;i++)
        scanf("%d",&ori[i]);
    for(int i=0;i<n/2;i++)
        a[i]=ori[i];
    for(int i=0;i<n/2;i++)
        b[i]=ori[i+n/2];
    const int N=1e9;
    for(;;)
    {
        int sum=0;
        for(int i=0;i<n/2;i++)
            sum += a[i];
        if(sum == N)
            break;
        int pos=rnd()%(n/2),j=0;
        for(int i=0;i<n/2;i++)
            if(abs(N-(sum-a[pos]+b[i]))<abs(N-(sum-a[pos]+b[j])))
                j=i;
        std::swap(a[pos],b[j]);
    }
    for(int i=0;i<n/2;i++)
        for(int j=0;j<n;j++)
            if(a[i] == ori[j])
                printf("%d%c",j+1," \n"[i == n/2-1]);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3892kb

input:

10
386413329 88494216 245947398 316438989 192751270 204627269 65749456 3938400 150458676 345180997

output:

1 7 5 6 9

result:

wrong answer need sum 1000000000, got sum  65749456