제출 #590875

#제출 시각아이디문제언어결과실행 시간메모리
590875Sam_a17Unscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
1 ms340 KiB
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <cstdio>
#include "messy.h"
using namespace std;

#define ll long long
#define ld long double

#define all(x) (x.begin(), x.end())
#define rall(x) (x.rbegin(), x.rend())
#define sz(x) (int)x.size()

vector<int> restore_permutation(int n, int w, int r) {
    
    string s(n, '0');
    for(int i = 0; i < n; i++) {
      s[i] = '1';
      add_element(s);
    }    
    
    compile_set();

    string si(n, '0');
    vector<int> answ(n, -1), used(n, -1);
    
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if(used[j] != -1) continue;
        si[j] = '1';
        if(check_element(si)) {
          answ[i] = j;
          used[j] = true;
          break;
        }
        si[i] = '0';
      }
    }

    return answ;
}
#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...