#include<stdio.h>
int d[100001], f[100002];
int main()
{
int n, i, j, k, a, max=0;
long long int z, ans=0;
scanf("%d", &n);
for(i=1;i<=n;i++){
scanf("%d", &a);
d[a]+=a;
if(max<a) max = a;
}
for(i=max;i>=1;i--) f[i] = f[i+1]+d[i];
for(i=1;i<=max-2;i++){
if(d[i]==0) continue;
for(j=i+1;j<max;j++){
if(d[j]==0) continue;
z = (f[j+1]*d[j])%1000000007;
z = (z*d[i])%1000000007;
ans = (ans+z)%1000000007;
}
}
printf("%lld", ans);
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 |
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 |
Correct |
1 ms |
1668 KB |
Output is correct |
2 |
Correct |
0 ms |
1668 KB |
Output is correct |
3 |
Correct |
3 ms |
1668 KB |
Output is correct |
4 |
Correct |
2 ms |
1668 KB |
Output is correct |
5 |
Correct |
2 ms |
1668 KB |
Output is correct |
6 |
Correct |
1 ms |
1668 KB |
Output is correct |
7 |
Correct |
2 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 |
3 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
1668 KB |
Output is correct |
6 |
Correct |
1 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 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |