제출 #69238

#제출 시각아이디문제언어결과실행 시간메모리
69238NavickUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
3 ms512 KiB
#include <bits/stdc++.h>
#include <vector>
#include "messy.h"

#define F first
#define S second
#define pii pair<int, int>
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const int maxN = 35;
int ans[maxN];
bool mark[maxN];

std::vector<int> restore_permutation(int n, int w, int r) {
  
	string s;
	for (int i=0; i<n; i++) s += '0';

	for (int i=1; i<=n; i++)
	{
		s[i - 1] = '1';
		add_element(s);
		
		//cout << s << endl;

	}

	compile_set();
	
	/*
	for (int i=0; i<16; i++)
	{
		string t; 
		for (int j=0; j<n; j++) t += '0';
		for (int j=0; j<4; j++)
			if(i & (1 << j)) t[j] = '1';
		cout << t << " --> " << check_element(t) << endl;
	}*/

	for (int i=1; i<=n; i++)
	{
		string r = "";
		for (int c=0; c<n; c++) r += '0';
		for (int c=0; c<n; c++)
			if(mark[c]) r[c] = '1';

		for (int c=0; c<n; c++)
		{
			if(mark[c]) continue ;
			r[c] = '1';
			//cout << r << endl;
			if(check_element(r)){ ans[c] = i-1; mark[c]=true; break; }
			r[c] = '0';

		}
	}

	vector <int> res;
	for (int i=0; i<n; i++) res.pb(ans[i]);
	
    return res;
}
#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...