# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143497 | muradeyn | Arranging Shoes (IOI19_shoes) | C++14 | 1065 ms | 2040 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) {
long long ret = 0;
int n = s.size();
for (int i = 0;i<n;i+=2) {
if (s[i] != -s[i + 1]) {
int fn;
for (int j = i + 2;j < n;j++) {
if (s[j] == -s[i + 1]) {
fn = j;
break;
}
}
while (fn != i + 1) {
ret++;
swap(s[fn] , s[fn - 1]);
fn--;
}
}
if (s[i] > s[i + 1]) {
ret++;
swap(s[i] , s[i + 1]);
}
}
return ret;
}
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... |