This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |