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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n, i, cont=0, a, b, j;
cin >> n;
ll xd[n];
bool lol=false;
for(i=0;i<n;i++) {
cin >> xd[i];
if(xd[i-1]>xd[i]) lol=true;
}
if(lol==false) {
cout << "0" << endl;
return 0;
}
for(i=1;i<n-1;i++) {
a=0;
b=0;
for(j=0;j<i;j++) {
if(xd[j]<xd[i]) a++;
}
for(j=i+1;j<n;j++) {
if(xd[j]<xd[i]) b++;
}
cont+=a*b;
}
cout << cont << endl;
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... |