#include<stdio.h>
#define MX 110001
#include<algorithm>
using namespace std;
int n;
long long int MOD=6000000042;
long long int a[MX],b[MX],c[MX],m,s,ss=1,ans;
int main(){
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
s+=a[i];
s%=MOD;
}
sort(a,a+n);
m=1;
b[1]=a[0],c[1]=1;
for(i=1;i<n;i++){
if(b[m]==a[i]){c[m]++;}
else{b[++m]=a[i],c[m]++;}
}
ss=s;
ss*=s;
ss=ss%MOD;
ss*=s;
ss=ss%MOD;
ans=ss;
for(i=1;i<=m;i++){
b[i]*=c[i];
b[i]%=MOD;
}
for(i=1;i<=m;i++){
ss=b[i]+b[i];
ss*=b[i];
ss=ss%MOD;
ss*=b[i];
ss=ss%MOD;
ss%=MOD;
ans+=ss;
ans%=MOD;
}
for(i=1;i<=m;i++){
ss=b[i]+b[i]+b[i];
ss*=b[i];
ss=ss%MOD;
ss*=s;
ss=ss%MOD;
ans+=(MOD-ss);
ans%=MOD;
}
long long int r=6;
printf("%lld",ans/r);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3660 KB |
Output is correct |
2 |
Correct |
0 ms |
3660 KB |
Output is correct |
3 |
Correct |
0 ms |
3660 KB |
Output is correct |
4 |
Correct |
0 ms |
3660 KB |
Output is correct |
5 |
Correct |
0 ms |
3660 KB |
Output is correct |
6 |
Correct |
0 ms |
3660 KB |
Output is correct |
7 |
Correct |
0 ms |
3660 KB |
Output is correct |
8 |
Correct |
0 ms |
3660 KB |
Output is correct |
9 |
Correct |
0 ms |
3660 KB |
Output is correct |
10 |
Correct |
0 ms |
3660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3660 KB |
Output is correct |
2 |
Correct |
0 ms |
3660 KB |
Output is correct |
3 |
Correct |
0 ms |
3660 KB |
Output is correct |
4 |
Correct |
0 ms |
3660 KB |
Output is correct |
5 |
Correct |
0 ms |
3660 KB |
Output is correct |
6 |
Correct |
0 ms |
3660 KB |
Output is correct |
7 |
Correct |
0 ms |
3660 KB |
Output is correct |
8 |
Correct |
0 ms |
3660 KB |
Output is correct |
9 |
Correct |
0 ms |
3660 KB |
Output is correct |
10 |
Correct |
0 ms |
3660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3660 KB |
Output is correct |
2 |
Correct |
0 ms |
3660 KB |
Output is correct |
3 |
Correct |
0 ms |
3660 KB |
Output is correct |
4 |
Correct |
0 ms |
3660 KB |
Output is correct |
5 |
Correct |
0 ms |
3660 KB |
Output is correct |
6 |
Correct |
0 ms |
3660 KB |
Output is correct |
7 |
Correct |
0 ms |
3660 KB |
Output is correct |
8 |
Correct |
0 ms |
3660 KB |
Output is correct |
9 |
Correct |
0 ms |
3660 KB |
Output is correct |
10 |
Correct |
0 ms |
3660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3660 KB |
Output is correct |
2 |
Correct |
0 ms |
3660 KB |
Output is correct |
3 |
Correct |
0 ms |
3660 KB |
Output is correct |
4 |
Correct |
0 ms |
3660 KB |
Output is correct |
5 |
Correct |
0 ms |
3660 KB |
Output is correct |
6 |
Correct |
0 ms |
3660 KB |
Output is correct |
7 |
Correct |
0 ms |
3660 KB |
Output is correct |
8 |
Correct |
0 ms |
3660 KB |
Output is correct |
9 |
Correct |
0 ms |
3660 KB |
Output is correct |
10 |
Correct |
0 ms |
3660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
3660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
3660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |