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 "shoes.h"
#include <bits/stdc++.h>
using namespace std;
using llong = long long;
long long count_swaps(vector<int> a) {
int n = a.size();
llong ans = 0;
vector<int> l, r;
for (int i = 0; i < n; ++i)
if (a[i] < 0)
l.push_back(i);
else
r.push_back(i);
for (int i = 0; i < n / 2; ++i)
{
ans += l[i] - 2 * i + (r[i] < l[i]);
ans += r[i] - 2 * i;
}
return ans;
}
# | 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... |