Submission #2001

# Submission time Handle Problem Language Result Execution time Memory
2001 2013-07-19T15:26:44 Z gs13105 지우개 (GA4_eraser) C++
0 / 100
12 ms 1668 KB
#include <stdio.h>
#define d 1000000007

int arr[100001],tmp[100001];

int main()
{
	int n,sum1=0,sum2=0,a,mx=0,i;
	long long vol=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a);
		mx=mx>a?mx:a;
		sum1+=a;
		sum1%=d;
		sum2+=a*a;
		sum2%=d;
		arr[a]++;
		tmp[i]=a;
	}
	vol+=sum1*sum1%d*sum1%d;
	for(i=0;i<n;i++)
	{
		vol+=d-tmp[i]*tmp[i]%d*(3*sum1-2*tmp[i])%d;
		vol%=d;
	}
  while(vol%6!=0)
    vol+=d;
	vol/=6;
vol%=d;
	for(i=1;i<=mx;i++)
	{
		if(arr[i]>=2)
		{
			if(arr[i]==2)
				vol+=d-i*i%d*(sum1-i)%d*(arr[i]*(arr[i]-1)/2%d)%d;
			else
				vol+=d-i*i%d*(arr[i]*(arr[i]-1)/2%d)%d*(sum1-i+i*(arr[i]-2)/3%d)%d;
			vol%=d;
		}
	}

	printf("%lld",vol%d);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1668 KB Output isn't correct
2 Halted 0 ms 0 KB -