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<stdio.h>
#include<stdlib.h>
int d[100001];
int compare(const void *a , const void *b){
return ( *(int*)a - *(int*)b );
}
int main()
{
int n, i, j, k;
long long sum=0, t;
scanf("%d", &n);
for(i=1;i<=n;i++)scanf("%d", &d[i]);
qsort(d, n+1, sizeof(int), compare);
for(i=1;i<=n;i++)for(j=i+1;j<=n;j++)for(k=j+1;k<=n;k++){
if(d[i] < d[j] && d[j] < d[k]){
t=d[i]*d[j]*d[k];
sum+=t;
if(sum>1000000007)sum%=1000000007;
}
}printf("%lld", sum);
}
# | 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... |