| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1321537 | husseinjuanda | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 568 KiB |
#include <bits/stdc++.h>
using namespace std;
#include "messy.h"
string h;
void dnc(int l, int r){
if(l == r) return;
int mid = (l+r)/2;
for(int i = l; i <= mid; i++){
h[i] = '1';
// cout << h << endl;
add_element(h);
h[i] = '0';
}
for(int i = l; i <= mid; i++){
h[i] = '1';
}
dnc(mid+1, r);
for(int i = l; i <= mid; i++){
h[i] = '0';
}
for(int i = mid+1; i <= r; i++){
h[i] = '1';
}
dnc(l, mid);
for(int i = l; i <= r; i++){
h[i] = '0';
}
}
vector<int> where;
vector<int> ans;
void dnc1(int l, int r){
if(l == r){
ans[where[0]] = l;
return;
}
int mid = (l+r)/2;
vector<int> w;
vector<int> w1;
string j = h;
string s = h;
// cout << l << " " << r << endl;
for(auto i : where){
// cout << i << " ";
h[i] = '1';
if(check_element(h)){
// cout << h << endl;
w.push_back(i);
j[i] = '0';
s[i] = '1';
}else{
j[i] = '1';
s[i] = '0';
w1.push_back(i);
}
h[i] = '0';
}
// cout << endl;
h = j;
where = w;
dnc1(l, mid);
h = s;
where = w1;
dnc1(mid+1, r);
}
std::vector<int> restore_permutation(int n, int w, int r) {
for(int i = 0; i < n; i++){
h += '0';
}
dnc(0, n-1);
compile_set();
for(int i = 0; i < n; i++){
where.push_back(i);
h[i] = '0';
}
ans.resize(n);
dnc1(0, n-1);
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... | ||||
