Submission #807806

# Submission time Handle Problem Language Result Execution time Memory
807806 2023-08-05T02:21:45 Z LIF Unscrambling a Messy Bug (IOI16_messy) C++14
0 / 100
1 ms 468 KB
#include <vector>
#include "messy.h"
#include<bits/stdc++.h>
using namespace std;
bool confirm[300005];
int go[300005];
int pp[300005];
std::vector<int> restore_permutation(int n, int w, int r) {
	for(int i=1;i<=n;i++)
	{
		string temp;
		for(int j=1;j<=i;j++)temp += "1";
		for(int j=i+1;j<=n;j++)temp += "0";
		add_element(temp);
		//cout<<temp<<endl;
		go[i-1] = -1;
	}
	compile_set();
	for(int i=0;i<n;i++)
	{
		string test;
		for(int j=0;j<n;j++)confirm[j] = false;
		for(int j=0;j<n;j++)test += "0";
		//for(int j=0;j<n;j++)cout<<go[j]<<" ";
		for(int k=0;k<n;k++)
		{
			if(go[k] != -1)
			{
				test[go[k]] = '1';
				confirm[go[k]] = true;
			}
		}
		for(int j=0;j<n;j++)pp[j] = j;
		for(int j=n-1;j>=0;j--)
		{
			int xx = (rand() % (j));
			swap(pp[xx],pp[j]);
		}		
		for(int j=0;j<n;j++)
		{
			int k = pp[j];
			if(confirm[k] == true)continue;
			test[k] = '1';
			if(check_element(test) == true)
			{
				go[i] = k;
				test[k] = '0';
				break;
			}
		//	cout<<test<<endl;
			test[k] = '0';
		}
	}
	vector<int> ans;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)if(go[j] == i)ans.push_back(j);
	}
	return ans;
	
    /*add_element("0");
    compile_set();
    check_element("0");
    return std::vector<int>();*/
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -