# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
792168 | prvocislo | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 2 ms | 480 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.
#pragma once
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
typedef long long ll;
typedef long double ld;
using namespace std;
void add_element(string x);
bool check_element(string x);
void compile_set();
vector<int> restore_permutation(int n, int w, int r)
{
string s(n, '0');
for (int b = 0; (1 << b) < n; b++)
{
for (int i = 0; i < n; i++) if (i & (1 << b))
{
s[i] = (s[i] == '0' ? '1' : '0');
add_element(s);
s[i] = (s[i] == '0' ? '1' : '0');
}
for (int i = 0; i < n; i++) if (i & (1 << b))
{
s[i] = (s[i] == '0' ? '1' : '0');
}
}
compile_set();
s.assign(n, '0');
vector<int> ip(n, 0); // zistime si pre kazdy prvok ze kto bol povodne
for (int b = 0; (1 << b) < n; b++)
{
for (int i = 0; i < n; i++)
{
s[i] = (s[i] == '0' ? '1' : '0');
if (check_element(s)) ip[i] ^= (1 << b);
s[i] = (s[i] == '0' ? '1' : '0');
}
for (int i = 0; i < n; i++) if (ip[i] & (1 << b))
{
s[i] = (s[i] == '0' ? '1' : '0');
}
}
return ip;
}
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... |