#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,x,ci=0,cd=0,cont=0;
cin>>n;
vector<long long> v;
v.reserve(n);
for(int i=0;i<n;i++){
cin>>x;
v.push_back(x);
}
for(int i=1;i<n-1;i++){
ci=0;cd=0;
for(int j=0;j<i;j++){
if(v[j]<v[i]){
ci++;
}
}
for(int k=i+1;k<n;k++){
if(v[k]<v[i]){
cd++;
}
}
cont+=ci*cd;
}
cout<<cont<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
2078 ms |
2584 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2076 ms |
2728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2076 ms |
2728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
81 ms |
356 KB |
Output is correct |
12 |
Correct |
76 ms |
360 KB |
Output is correct |
13 |
Correct |
83 ms |
356 KB |
Output is correct |
14 |
Correct |
79 ms |
340 KB |
Output is correct |
15 |
Correct |
73 ms |
352 KB |
Output is correct |
16 |
Correct |
74 ms |
340 KB |
Output is correct |
17 |
Correct |
75 ms |
360 KB |
Output is correct |
18 |
Correct |
77 ms |
352 KB |
Output is correct |
19 |
Correct |
85 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2076 ms |
2728 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
2078 ms |
2584 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |