# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1247649 | julia_08 | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 128;
int to[MAXN], marc[MAXN];
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; i++){
s[n - 1 - i] = '1';
add_element(s);
}
compile_set();
vector<int> ans(n);
string cur;
for(int i=0; i<n; i++) cur.push_back('0');
vector<int> v;
for(int i=0; i<n; i++) v.push_back(i);
for(int i=0; i<n; i++){
bool ok = false;
for(int k=0; k<v.size(); k++){
int j = v[k];
if(j != i) continue;
cur[n - 1 - j] = '1';
if(check_element(cur)){
to[n - 1 - i] = n - 1 - j;
marc[j] = 1;
swap(v[k], v.back());
v.pop_back();
ok = true;
break;
} else cur[n - 1 - j] = '0';
}
if(ok) continue;
shuffle(v.begin(), v.end(), rng);
for(int k=0; k<v.size(); k++){
int j = v[k];
cur[n - 1 - j] = '1';
if(check_element(cur)){
to[n - 1 - i] = n - 1 - j;
marc[j] = 1;
swap(v[k], v.back());
v.pop_back();
break;
} else cur[n - 1 - j] = '0';
}
}
for(int i=0; i<n; i++) ans[to[i]] = i;
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... |