# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
813687 | math_rabbit_1028 | Arranging Shoes (IOI19_shoes) | C++14 | 1085 ms | 1876 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;
typedef long long ll;
int n;
long long count_swaps(std::vector<int> s) {
int ans = 0;
n = s.size()/2;
for (int i = 0; i < 2 * n; i += 2) {
int k;
for (int j = i + 1; j < 2 * n; j++) {
if (-s[i] == s[j]) {
k = j;
break;
}
}
for (int j = k - 1; j > i; j--) {
swap(s[j + 1], s[j]);
ans++;
}
if (s[i] > 0) {
swap(s[i], s[i + 1]);
ans++;
}
}
return ans;
}
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... |