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;
long long count_swaps(vector<int> a) {
int n = a.size() / 2;
long long ans = 0;
while (n) {
int x = a[0];
int ind = 1;
while (a[ind] != -x) {
ind++;
}
if (x < 0) {
ans += ind - 1;
} else {
ans += ind;
}
a.erase(a.begin() + ind);
a.erase(a.begin());
n--;
}
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... |