#include <iostream>
#include <algorithm>
using namespace std;
int pre(const int a, const int b){return a > b;}
int main()
{
int num, i, j, k;
long sum = 0;
cin >> num;
int *p = new int[num];
for(i = 0; i < num; i++)
cin >> p[i];
sort(p, p+num, pre);
for(i = 0; i < num-2; i++)
{
for(j = i+1; j < num-1; j++)
{
if(p[i] > p[j])
{
for(k = j+1; k < num; k++)
{
if(p[j] > p[k])
{
sum += p[i] * p[j] * p[k];
if(sum > 1000000007)
sum %= 1000000007;
}
}
}
}
}
cout << sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1376 KB |
Output is correct |
2 |
Correct |
0 ms |
1376 KB |
Output is correct |
3 |
Correct |
0 ms |
1376 KB |
Output is correct |
4 |
Correct |
0 ms |
1376 KB |
Output is correct |
5 |
Correct |
0 ms |
1376 KB |
Output is correct |
6 |
Correct |
0 ms |
1376 KB |
Output is correct |
7 |
Correct |
0 ms |
1376 KB |
Output is correct |
8 |
Correct |
0 ms |
1376 KB |
Output is correct |
9 |
Correct |
0 ms |
1376 KB |
Output is correct |
10 |
Correct |
0 ms |
1376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1376 KB |
Output is correct |
2 |
Correct |
0 ms |
1376 KB |
Output is correct |
3 |
Correct |
0 ms |
1376 KB |
Output is correct |
4 |
Correct |
0 ms |
1376 KB |
Output is correct |
5 |
Correct |
0 ms |
1376 KB |
Output is correct |
6 |
Correct |
0 ms |
1376 KB |
Output is correct |
7 |
Correct |
0 ms |
1376 KB |
Output is correct |
8 |
Correct |
0 ms |
1376 KB |
Output is correct |
9 |
Correct |
0 ms |
1376 KB |
Output is correct |
10 |
Correct |
0 ms |
1376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
1376 KB |
Output is correct |
2 |
Correct |
18 ms |
1376 KB |
Output is correct |
3 |
Correct |
230 ms |
1376 KB |
Output is correct |
4 |
Correct |
164 ms |
1376 KB |
Output is correct |
5 |
Correct |
243 ms |
1376 KB |
Output is correct |
6 |
Correct |
155 ms |
1376 KB |
Output is correct |
7 |
Correct |
169 ms |
1376 KB |
Output is correct |
8 |
Correct |
0 ms |
1376 KB |
Output is correct |
9 |
Correct |
0 ms |
1376 KB |
Output is correct |
10 |
Correct |
234 ms |
1376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
1376 KB |
Output is correct |
2 |
Correct |
12 ms |
1376 KB |
Output is correct |
3 |
Correct |
0 ms |
1376 KB |
Output is correct |
4 |
Correct |
33 ms |
1376 KB |
Output is correct |
5 |
Correct |
354 ms |
1376 KB |
Output is correct |
6 |
Correct |
102 ms |
1376 KB |
Output is correct |
7 |
Correct |
64 ms |
1376 KB |
Output is correct |
8 |
Correct |
7 ms |
1376 KB |
Output is correct |
9 |
Correct |
5 ms |
1376 KB |
Output is correct |
10 |
Correct |
4 ms |
1376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |