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