#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 |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1276 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |