This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |