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;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
const ll N = 2005;
int count_swaps(vector <int> vc) {
ll n, i, res, j, k;
n = vc.size();
res = 0;
for(i = 0; i < n; i += 2) {
for(j = i + 1; j < n; j++) {
if(-vc[i] == vc[j]) {
for(k = j; k >= i + 2; k--) {
swap(vc[k], vc[k - 1]);
res++;
}
break;
}
}
res += (!(abs(vc[i]) == abs(vc[i + 1]) && vc[i] < vc[i + 1]));
}
return res;
}
# | 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... |