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