Submission #308415

#TimeUsernameProblemLanguageResultExecution timeMemory
308415talant117408Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
2 ms384 KiB
#include "messy.h"
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <ll, ll> pii;
 
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

std::vector<int> restore_permutation(int n, int w, int r) {
    vector <int> p(n, -1), vis(n);
    string in = "", out = "";
    for(int i = 0; i < n; i++){
        in += "0";
        out += "0";
    }
    for(int i = 0; i < n; i++){
        in[i] = '1';
        add_element(in);
    }
    
    compile_set();
    
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(vis[j]) continue;
            out[j] = '1';
            if(check_element(out)){
                vis[j]++;
                p[j] = i;
                break;
            }
            out[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...