# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
722867 | GrandTiger1729 | Arranging Shoes (IOI19_shoes) | C++17 | 1095 ms | 2652 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;
j = i + 1;
while (j < N && a[j] != -a[i]) j++;
while (j > i + 1){
swap(a[j], a[j - 1]);
j--;
cnt++;
}
if (a[i] > 0){
swap(a[i], a[i + 1]);
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... |