# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1044528 | fv3 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 1 ms | 388 KiB |
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 "messy.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> restore_permutation(int N, int W, int R)
{
// Try with different bitcounts:
// 1000
// 1100
// 1110
// w = n - 1
// r = n*(n+1)/2 - 1
string element(N, '0');
for (int i = 0; i < N - 1; i++)
{
element[i] = '1';
add_element(element);
}
compile_set();
vector<int> perm(N, -1);
string securedBits(N, '0');
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (securedBits[j] == '1') continue;
securedBits[j] = '1';
if (check_element(securedBits))
{
perm[j] = i;
break;
}
securedBits[j] = '0';
}
}
int sum = 0;
int index;
for (int i = 0; i < N; i++)
{
if (perm[i] == -1)
index = i;
else
sum += perm[i];
}
perm[index] = (N * N - N) / 2 - sum;
return perm;
}
Compilation message (stderr)
# | 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... |