QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#800853 | #8790. First Billion | ucup-team6015# | WA | 0ms | 3892kb | C++14 | 824b | 2024-12-06 16:14:14 | 2024-12-06 16:14:15 |
Judging History
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