# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1247727 | m_bezrutchka | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 0 ms | 328 KiB |
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> restore_permutation(int n, int w, int r) {
string s = "";
for (int i = 0; i < n; i++) {
s.push_back('0');
}
for (int i = 0; i < n - 1; i++) {
s[i] = '1';
add_element(s);
}
compile_set();
for (int i = 0; i < n; i++) {
s[i] = '0';
}
vector<int> p(n, -1);
for (int i = 0; i < n; i++) {
vector<int> to_test;
for (int j = 0; j < n; j++) {
if (s[j] == '1') continue;
to_test.push_back(j);
}
shuffle(to_test.begin(), to_test.end(), rng);
for (int j: to_test) {
s[j] = '1';
bool found = check_element(s);
if (found) {
p[j] = i;
break;
}
s[j] = '0';
}
}
int missing_val = (n * (n - 1)) / 2;
int missing_idx = -1;
for (int i = 0; i < n; i++) {
if (p[i] == -1) {
missing_idx = i;
}
else {
missing_val -= p[i];
}
}
p[missing_idx] = missing_val;
return p;
}
컴파일 시 표준 에러 (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... |