Submission #2392

#TimeUsernameProblemLanguageResultExecution timeMemory
2392hgp744지우개 (GA4_eraser)C++98
46 / 100
1000 ms2448 KiB
#include<stdio.h> long long int d[100001], f[100002]; int main() { int n, i, j, k, a, max=0; long long int z, ans=0; scanf("%d", &n); for(i=1;i<=n;i++){ scanf("%d", &a); d[a]+=a; if(max<a) max = a; } for(i=max;i>=1;i--) f[i] = f[i+1]+d[i]; for(i=1;i<=max-2;i++){ if(d[i]==0) continue; for(j=i+1;j<max;j++){ if(d[j]==0) continue; z = (f[j+1]*d[j])%1000000007; z = (z*d[i])%1000000007; ans = (ans+z)%1000000007; } } printf("%lld", ans); 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...