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 "messy.h"
using namespace std;
typedef long long ll;
string bin(int x, int n)
{
string res = "";
for (int i = 0; i < n; i++)
{
res.push_back('0' + (x & 1));
x /= 2;
}
reverse(res.begin(), res.end());
return res;
}
vector<int> restore_permutation(int n, int w, int r)
{
if (n == 8)
{
add_element("10000000");
add_element("11000000");
add_element("11100000");
add_element("11110000");
add_element("11111000");
add_element("11111100");
add_element("11111110");
add_element("11111111");
compile_set();
vector<vector<string>> numz(n);
for (int i = 1; i < 256; i++)
numz[__builtin_popcount(i) - 1].push_back(bin(i, n));
vector<int> res(n, -1);
for (int i = 0; i < n; i++)
for (string s : numz[i])
if (check_element(s))
{
for (int j = 0; j < n; j++)
if (s[j] == '1' && res[j] == -1)
{
res[j] = i;
break;
}
break;
}
return res;
}
return vector<int>();
}
# | 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... |