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 ll = long long;
ll count_swaps(vector<int> s) {
int n = s.size() / 2;
int ans = 0;
for (int i = 0; i < 2 * n; i += 2) {
int x = i;
while (s[x] > 0) {
x++;
}
for (int j = x; j > i; j--) {
ans++;
swap(s[j], s[j - 1]);
}
x = i + 1;
while (s[x] != -s[i]) {
x++;
}
for (int j = x; j > i + 1; j--) {
ans++;
swap(s[j], s[j - 1]);
}
}
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... |