제출 #1013731

#제출 시각아이디문제언어결과실행 시간메모리
1013731hotboy2703Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms348 KiB
#include <vector>

#include<bits/stdc++.h>
using namespace std;
using ll = int;
#define pll pair <ll,ll>
#define fi first
#define se second
#define MP make_pair
#define sz(a) (ll((a).size()))
#define BIT(mask,i) (((mask) >> (i))&1)
#define MASK(i) (1LL << (i))

#include "messy.h"

std::vector<int> restore_permutation(int n, int w, int r) {
    vector <ll> p(n,-1);
    for (ll i = 0;i < n; i++){
        string s;
        s.resize(n);
        for (ll j = 0;j < n;j ++){
            if (j <= i)s[j] = '1';
            else s[j] = '0';
        }
        add_element(s);
    }
    compile_set();
    for (ll i = 0;i < n; i++){
        string s;
        s.resize(n,'0');
        for (ll j = 0;j < n;j ++)if (p[j] != -1)s[j] = '1';
        for (ll j = 0;j < n;j ++){
            if (s[j]=='0'){
                s[j] = '1';
                if (check_element(s)){
//                    cout<<"OK"<<endl;
                    p[j] = i;
                    break;
                }
                s[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...