# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
185301 | RiscadoA | Arranging Shoes (IOI19_shoes) | C++14 | 3 ms | 504 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"
long long count_swaps(std::vector<int> s) {
int c = 0;
for (int i = 0; i < s.size() - 1; ++i) {
int j = i + 1;
for (; j < s.size(); ++j) {
if (s[j] == -s[i]) {
break;
}
}
s.erase(s.begin() + j);
if (s[i] < 0) {
c += j - i - 1;
s.insert(s.begin() + i + 1, -s[i]);
} else {
c += j - i;
s.insert(s.begin() + i, -s[i]);
}
}
return c;
}
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... |