This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#ifdef DEBUGGING
#include "../debug.h"
#else
#define debug(x...) void(42)
#endif
#include "messy.h"
vector<int> restore_permutation(int n, int w, int r)
{
for (int i = 0; i < n-1; i++)
{
string s(n, '0');
for (int j = 0; j <= i; j++)
s[j] = '1';
for (int j = i+1; j < n; j++)
s[j] = '0';
add_element(s);
}
compile_set();
vector<int> p(n);
set<int> av;
for (int i = 0; i < n; i++)
av.insert(i);
string current(n, '0');
for (int i = 0; i < n; i++)
current[i] = '0';
for (int i = 0; i < n-1; i++)
{
int j;
bool found = false;
for (auto it = av.begin(); !found && it != av.end(); it++)
{
j = *it;
current[j] = '1';
debug(j, current.c_str());
if (check_element(current))
{
found = true;
break;
}
current[j] = '0';
}
assert(found);
p[j] = i;
av.erase(j);
}
assert(av.size() == 1);
p[*av.begin()] = n-1;
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |