| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1370144 | kawhiet | Arranging Shoes (IOI19_shoes) | C++20 | 1095 ms | 1960 KiB |
#include <bits/stdc++.h>
#include "shoes.h"
using namespace std;
long long count_swaps(vector<int> a) {
int n = a.size();
long long ans = 0;
for (int i = 0; i < n; i += 2) {
if (a[i] < 0 && a[i + 1] > 0 && -a[i] == a[i + 1]) {
continue;
}
for (int j = i + 1; j < n; j++) {
if (-a[i] == a[j]) {
for (int k = j - 1; k > i; k--) {
ans++;
swap(a[k], a[k + 1]);
}
break;
}
}
assert(-a[i] == a[i + 1]);
if (a[i] > 0) {
ans++;
swap(a[i], a[i + 1]);
}
}
return ans;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
