# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1213674 | toast12 | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
string s = "";
for (int i = 0; i < n; i++) s += '0';
for (int i = n-1; i >= 0; i--) {
s[i] = '1';
add_element(s);
}
compile_set();
vector<int> ans(n, -1);
vector<bool> done(n);
for (int i = n-1; i >= 0; i--) s[i] = '0';
for (int idx = n-1; idx >= 0; idx--) {
int temp = 0;
for (int i = n-1; i >= 0; i--) {
if (s[i] == '0') {
s[i] = '1';
temp = i;
break;
}
}
while (true) {
bool ret = check_element(s);
if (ret) {
for (int i = 0; i < n; i++) {
if (s[i] == '1' && ans[i] == -1) {
ans[i] = idx;
break;
}
}
break;
}
for (int i = temp-1; i >= 0; i--) {
if (s[i] == '0') {
s[i] = '1';
s[temp] = '0';
temp = i;
break;
}
}
}
}
return ans;
}
컴파일 시 표준 에러 (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... |