# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1242745 | iyedoo | Arranging Shoes (IOI19_shoes) | C++20 | 0 ms | 320 KiB |
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count_swaps(vector<int> s) {
ll n = s.size();
vector<int> perm;
for (int i = 0; i < n; ++i) {
if (s[i] < 0) perm.push_back(abs(s[i]));
}
sort(perm.begin(), perm.end());
ll mn = LLONG_MAX;
do {
ll cnt = 0;
vector<int> goal, temp = s;
for (int i = 0; i < n / 2; ++i) {
goal[2 * i] = -1 * perm[i];
goal[2 * i + 1] = perm[i];
}
for (int i = 0; i < n; ++i) {
for (int j = i; j < n; ++j) {
if (temp[j] == goal[i]) {
while (j != i) {
swap(temp[j], temp[j - 1]);
j--;
cnt++;
}
break;
}
}
}
mn = min(mn, cnt);
}
while (next_permutation(perm.begin(), perm.end()));
}
컴파일 시 표준 에러 (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... |