Submission #1036832

#TimeUsernameProblemLanguageResultExecution timeMemory
1036832kachim2Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms432 KiB
#include <vector>
#include <iostream>
#include "messy.h"

std::vector<int> restore_permutation(int n, int w, int r)
{
	for (int i = 1; i <= n; i++)
	{

		//std::cerr << (std::string(i, '1') + std::string(n-i, '0')) << '\n';
		add_element(std::string(i, '1') + std::string(n-i, '0'));
	}
	compile_set();
	std::string base(n, '0');
	std::vector<int> ans(n);
	for (int j = 0; j < n; j++)
	{
		for (int i = 0; i <n; i++)
		{
			std::string now = base;
			now[i] = '1';
			if (now != base)
			{
				//std::cerr << now << '\n';
				if (check_element(now))
				{
					base = now;
					ans[i] = j;
					//std::cerr << i << ' ' << j << '\n';
					break;
				}
			}
		}
	}
	return ans;
}
#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...