Submission #3688649


Source Code Expand

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;

const int N=3e5+5;
int n,s[N];
long long ans;

void init()
{
	int i;
	scanf("%d",&n);
	for(i=1;i<=2*n;++i) scanf("%d",&s[i]);
	sort(s+1,s+2*n+1);
}

void work()
{
	int i;
	for(i=1;i<=2*n;++i) ans+=1LL*(i-1)*s[i];
	printf("%.12lf\n",1.0*ans/(2*n-1));
}

int main()
{
	init();
	work();
	return 0;
}

Submission Info

Submission Time
Task J - Indifferent
User luogu_bot3
Language C++ (GCC 5.4.1)
Score 100
Code Size 477 Byte
Status AC
Exec Time 34 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘void init()’:
./Main.cpp:17:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
./Main.cpp:18:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for(i=1;i<=2*n;++i) scanf("%d",&s[i]);
                                       ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 43
Set Name Test Cases
Sample a01, a02
All a01, a02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
b03 AC 1 ms 256 KB
b04 AC 1 ms 256 KB
b05 AC 23 ms 1024 KB
b06 AC 34 ms 1024 KB
b07 AC 1 ms 256 KB
b08 AC 1 ms 256 KB
b09 AC 1 ms 256 KB
b10 AC 1 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 1 ms 256 KB
b13 AC 1 ms 256 KB
b14 AC 1 ms 256 KB
b15 AC 1 ms 256 KB
b16 AC 1 ms 256 KB
b17 AC 1 ms 256 KB
b18 AC 1 ms 256 KB
b19 AC 1 ms 256 KB
b20 AC 1 ms 256 KB
b21 AC 1 ms 256 KB
b22 AC 1 ms 256 KB
b23 AC 2 ms 256 KB
b24 AC 2 ms 256 KB
b25 AC 2 ms 256 KB
b26 AC 2 ms 256 KB
b27 AC 4 ms 256 KB
b28 AC 6 ms 384 KB
b29 AC 7 ms 384 KB
b30 AC 9 ms 512 KB
b31 AC 19 ms 640 KB
b32 AC 27 ms 896 KB
b33 AC 34 ms 1024 KB
b34 AC 34 ms 1024 KB
b35 AC 34 ms 1024 KB
b36 AC 34 ms 1024 KB
b37 AC 34 ms 1024 KB
b38 AC 34 ms 1024 KB
b39 AC 34 ms 1024 KB
b40 AC 34 ms 1024 KB
b41 AC 34 ms 1024 KB
b42 AC 34 ms 1024 KB
b43 AC 34 ms 1024 KB