# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722852 | GrandTiger1729 | Arranging Shoes (IOI19_shoes) | C++17 | 1089 ms | 2644 KiB |
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;
long long count_swaps(vector<int> s){
auto a = s;
int N = a.size(), n = N / 2;
long long cnt = 0;
for (int i = 0; i < N; i += 2){
int j = i;
while (j < N && a[j] > 0) j++;
while (j > i){
swap(a[j], a[j - 1]);
j--;
cnt++;
}
j = i + 1;
while (j < N && a[j] != -a[i]) j++;
while (j > i + 1){
swap(a[j], a[j - 1]);
j--;
cnt++;
}
}
return cnt;
}
Compilation message (stderr)
# | 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... |