Submission #299840

#TimeUsernameProblemLanguageResultExecution timeMemory
299840MatheusLealVUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
2 ms384 KiB
#include <bits/stdc++.h>
#include "messy.h"
#define pb push_back
using namespace std;

vector<int> restore_permutation(int n, int w, int r) {
  
  string curr;
  for(int i = 0; i < n; i++) curr.pb('1');

  for(int i = 0; i < n; i++){
  	curr[i] = '0';
  	add_element(curr);
  }

  compile_set();

  set<int> caras;
  vector<int> p(n);
  for(int i = 0; i < n; i++){
  	string aux;
  	for(int j = 0; j < n; j++){
  		if(caras.count(j))aux.pb('0');
  		else aux.pb('1');
  	}
  	for(int j = 0; j < n; j++){
  		if(aux[j] == '1'){
  			string P = aux;
  			P[j] = '0';
  			if(check_element(P)){
  				caras.insert(j);
  				// p[i]=j;
  				p[j]=i;
  			}
  		}
  	}
  }
  // for(int i = 0; i < n; i++) cout<<p[i]<<" ";
  // cout<<"\n";
  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...