#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
int n;
cin>>n;
vector<int> v(n);
for(int i=0; i<n; i++){
cin>>v[i];
}
int cont=1;
ll ans=0;
int a,b;
while(cont<n-1){
a=0;
b=0;
for(int i=0; i<cont; i++){
if(v[i]<v[cont]) a++;
}
for(int i=cont+1; i<n; i++){
if(v[i]<v[cont]) b++;
}
ans+=a*b;
cont++;
}
cout<<ans<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
2095 ms |
1364 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2094 ms |
1364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2094 ms |
1364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2094 ms |
1364 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 |
2095 ms |
1364 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |