Submission #1993

#TimeUsernameProblemLanguageResultExecution timeMemory
1993gs13105지우개 (GA4_eraser)C++98
0 / 100
12 ms1668 KiB
#include <stdio.h> #define d 1000000007 int arr[100001],tmp[100001]; int main() { int n,sum1=0,sum2=0,a,mx=0,i; long long vol=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a); mx=mx>a?mx:a; sum1+=a; sum1%=d; sum2+=a*a; sum2%=d; arr[a]++; tmp[i]=a; } vol+=sum1*sum1%d*sum1%d; for(i=0;i<n;i++) { vol+=d-tmp[i]*tmp[i]%d*(3*sum1-2*tmp[i])%d; vol%=d; } vol/=6; /* for(i=1;i<=mx;i++) { if(arr[i]>=2) { if(arr[i]==2) vol+=d-i*i%d*(sum1-i)%d*(arr[i]*(arr[i]-1)/2%d)%d; else vol+=d-i*i%d*(arr[i]*(arr[i]-1)/2%d)%d*(sum1-i+i*(arr[i]-2)/3%d)%d; vol%=d; } }*/ printf("%lld",vol%d); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...