#include <stdio.h>
#define d 1000000007
long long arr[100001];
int main()
{
int n,i;
long long sum1=0,sum2=0,sum3=0,vol;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
sum1+=arr[i];
sum1%=d;
sum2+=arr[i]*arr[i];
sum2%=d;
sum3+=((arr[i]*arr[i])%d)*arr[i];
sum3%=d;
}
vol=((((sum1*sum1)%d)*sum1)%d-sum3)%d;
for(i=0;i<n;i++)
{
vol-=(3*((arr[i]*arr[i])%d)*(sum1-arr[i]))%d;
vol+=d;
vol%=d;
}
while(vol%6!=0)
vol+=d;
vol/=6;
printf("%lld",vol%d);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
0 ms |
1668 KB |
Output is correct |
5 |
Correct |
0 ms |
1668 KB |
Output is correct |
6 |
Correct |
0 ms |
1668 KB |
Output is correct |
7 |
Correct |
0 ms |
1668 KB |
Output is correct |
8 |
Correct |
0 ms |
1668 KB |
Output is correct |
9 |
Correct |
0 ms |
1668 KB |
Output is correct |
10 |
Correct |
0 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
0 ms |
1668 KB |
Output is correct |
5 |
Correct |
0 ms |
1668 KB |
Output is correct |
6 |
Correct |
0 ms |
1668 KB |
Output is correct |
7 |
Correct |
0 ms |
1668 KB |
Output is correct |
8 |
Correct |
0 ms |
1668 KB |
Output is correct |
9 |
Correct |
0 ms |
1668 KB |
Output is correct |
10 |
Correct |
0 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
1668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
8 ms |
1668 KB |
Output is correct |
5 |
Correct |
0 ms |
1668 KB |
Output is correct |
6 |
Correct |
10 ms |
1668 KB |
Output is correct |
7 |
Correct |
4 ms |
1668 KB |
Output is correct |
8 |
Correct |
16 ms |
1668 KB |
Output is correct |
9 |
Correct |
10 ms |
1668 KB |
Output is correct |
10 |
Correct |
11 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
1668 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |