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;
int main()
{
int n, l, r, i, j;
long long s=0;
cin >> n;
long long a[n];
for (i=0; i<n; i++)
cin >> a[i];
for (i=0; i<n; i++)
{
l=0;
r=0;
for (j=0; j<i; j++)
if (a[j]<a[i])
l=l+1;
for (j=i+1; j<n; j++)
if (a[j]<a[i])
r=r+1;
s=s+(l*r);
}
cout << s;
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... |