#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long long int c[300000];
int main(){
int n;
cin >> n;
long long int ans = 0;
for(int i = 0; i < n; i++){
cin >> c[i];
}
for(int i = 1; i < n - 1; i++){
long long int a = 0, b = 0;
for(int j = 0; j < i; j++){
if(c[j] < c[i])a++;
}
for(int j = i + 1; j < n; j++){
if(c[j] < c[i])b++;
}
ans += a * b;
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
2065 ms |
2600 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2076 ms |
2588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2076 ms |
2588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
119 ms |
348 KB |
Output is correct |
12 |
Correct |
132 ms |
364 KB |
Output is correct |
13 |
Correct |
111 ms |
348 KB |
Output is correct |
14 |
Correct |
111 ms |
352 KB |
Output is correct |
15 |
Correct |
111 ms |
356 KB |
Output is correct |
16 |
Correct |
109 ms |
352 KB |
Output is correct |
17 |
Correct |
109 ms |
348 KB |
Output is correct |
18 |
Correct |
108 ms |
348 KB |
Output is correct |
19 |
Correct |
105 ms |
352 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2076 ms |
2588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
2065 ms |
2600 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |