제출 #1340468

#제출 시각아이디문제언어결과실행 시간메모리
1340468SulAUnscrambling a Messy Bug (IOI16_messy)C++20
38 / 100
1 ms360 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include "messy.h"
#define all(a) (a).begin(), (a).end()
#define popcount __builtin_popcountll
using namespace std;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update>;

// void add_element(string s) { cout << "+ " << s << endl; }
// void compile_set() {}
// bool check_element(string s) { cout << "? " << s << endl; int res; cin >> res; return res; }

vector<int> restore_permutation(int n, int w, int r) {
    {
        string num(n, '0');
        for (int i = 0; i < n; i++) {
            num[i] = '1';
            add_element(num);
        }
        compile_set();
    }
    vector<int> p(n, -1);
    for (int i = 0; i < n; i++) {
        string num = string(n, '0');
        for (int j = 0; j < n; j++)
            if (p[j] != -1)
                num[j] = '1';
        for (int j = 0; j < n; j++) {
            if (num[j] == '1')
                continue;
            num[j] = '1';
            if (check_element(num)) {
                p[j] = i;
                break;
            }
            num[j] = '0';
        }
    }
    return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...