Submission #116440

#TimeUsernameProblemLanguageResultExecution timeMemory
116440AdOjis485Unscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
3 ms384 KiB
//
//  main.cpp
//  2016_messy
//
//  Created by Ema Skottova on 12.06.19.
//  Copyright © 2019 Ema Skottova. All rights reserved.
//

#include <vector>
#include "messy.h"
using namespace std;

std::vector<int> restore_permutation(int n, int w, int r) {
    string s(n, '0');
    for(int i = 0; i < n - 1; i ++){
        s[n - i - 1] = '1';
        add_element(s);
    }
    compile_set();
    int n2 = 1;
    for(int i = 0; i < n; i ++){
        n2 *= 2;
    }
    vector<int> a(n, 0);
    //vector<string> b(n2);
    for(int i = 1; i < n2; i ++){
        int y = i;
        string x(n, '0');
        for(int j = 0; j < n; j ++){
            if(y % 2 == 1){
                x[j] = '1';
            }
            y /= 2;
        }/*
        cout << "check " << x << '\n';
        cin >> b[i];
        if(b[i] == "true"){*/
        if(check_element(x)){
            y = i;
            for(int j = 0; j < n; j ++){
                a[j] += y % 2;
                y /= 2;
            }
        }
    }
    return a;
}
/*
int main(){
    int n, w, r;
    cin >> n >> w >> r;
    vector<int> a = restore_permutation(n, w, r);
    for(int i = 0; i < n; i ++){
        cout << a[i] << " ";
    }
    cout << '\n';
}
*/
#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...