#include<cstdio>
long long a[100001];
long long x,y,z,answer;
int main()
{
int i,j,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&j);
a[j]+=j;
a[j]%=1000000007;
}
for(i=1;i<=100000;i++)
{
x+=a[i];
x%=1000000007;
y+=a[i]*a[i]%1000000007;
y%=1000000007;
z+=a[i]*a[i]%1000000007*a[i]%1000000007;
z%=1000000007;
}
answer=x*x%1000000007*x%1000000007;
answer-=3*x%1000000007*y%1000000007;
answer+=1000000007;
answer%=1000000007;
answer+=2*z%1000000007;
answer%=1000000007;
answer*=166666668;
answer%=1000000007;
printf("%lld",answer);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
1 ms |
1668 KB |
Output is correct |
5 |
Correct |
0 ms |
1668 KB |
Output is correct |
6 |
Correct |
1 ms |
1668 KB |
Output is correct |
7 |
Correct |
1 ms |
1668 KB |
Output is correct |
8 |
Correct |
1 ms |
1668 KB |
Output is correct |
9 |
Correct |
1 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 |
1 ms |
1668 KB |
Output is correct |
3 |
Correct |
1 ms |
1668 KB |
Output is correct |
4 |
Correct |
1 ms |
1668 KB |
Output is correct |
5 |
Correct |
1 ms |
1668 KB |
Output is correct |
6 |
Correct |
1 ms |
1668 KB |
Output is correct |
7 |
Correct |
1 ms |
1668 KB |
Output is correct |
8 |
Correct |
1 ms |
1668 KB |
Output is correct |
9 |
Correct |
1 ms |
1668 KB |
Output is correct |
10 |
Correct |
1 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1668 KB |
Output is correct |
2 |
Correct |
1 ms |
1668 KB |
Output is correct |
3 |
Correct |
0 ms |
1668 KB |
Output is correct |
4 |
Correct |
1 ms |
1668 KB |
Output is correct |
5 |
Correct |
1 ms |
1668 KB |
Output is correct |
6 |
Correct |
1 ms |
1668 KB |
Output is correct |
7 |
Correct |
1 ms |
1668 KB |
Output is correct |
8 |
Correct |
1 ms |
1668 KB |
Output is correct |
9 |
Correct |
0 ms |
1668 KB |
Output is correct |
10 |
Correct |
2 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1668 KB |
Output is correct |
2 |
Correct |
1 ms |
1668 KB |
Output is correct |
3 |
Correct |
1 ms |
1668 KB |
Output is correct |
4 |
Correct |
1 ms |
1668 KB |
Output is correct |
5 |
Correct |
1 ms |
1668 KB |
Output is correct |
6 |
Correct |
1 ms |
1668 KB |
Output is correct |
7 |
Correct |
1 ms |
1668 KB |
Output is correct |
8 |
Correct |
1 ms |
1668 KB |
Output is correct |
9 |
Correct |
1 ms |
1668 KB |
Output is correct |
10 |
Correct |
1 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
1668 KB |
Output is correct |
2 |
Correct |
2 ms |
1668 KB |
Output is correct |
3 |
Correct |
3 ms |
1668 KB |
Output is correct |
4 |
Correct |
12 ms |
1668 KB |
Output is correct |
5 |
Correct |
1 ms |
1668 KB |
Output is correct |
6 |
Correct |
12 ms |
1668 KB |
Output is correct |
7 |
Correct |
5 ms |
1668 KB |
Output is correct |
8 |
Correct |
15 ms |
1668 KB |
Output is correct |
9 |
Correct |
10 ms |
1668 KB |
Output is correct |
10 |
Correct |
13 ms |
1668 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
1668 KB |
Output is correct |
2 |
Correct |
1 ms |
1668 KB |
Output is correct |
3 |
Correct |
12 ms |
1668 KB |
Output is correct |
4 |
Correct |
3 ms |
1668 KB |
Output is correct |
5 |
Correct |
18 ms |
1668 KB |
Output is correct |
6 |
Correct |
4 ms |
1668 KB |
Output is correct |
7 |
Correct |
12 ms |
1668 KB |
Output is correct |
8 |
Correct |
14 ms |
1668 KB |
Output is correct |
9 |
Correct |
16 ms |
1668 KB |
Output is correct |
10 |
Correct |
14 ms |
1668 KB |
Output is correct |