# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1022577 | jamjanek | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 2 ms | 604 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.
//Rozwiazanie pelne k = m = n*log(n)
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
string pop[2];
int liczby[200];
void dodaj1(string s){
add_element(s);
// cout<<"D:"<<s<<'\n';
}
bool zapytaj1(string s){
bool czy = check_element(s);
// cout<<"Z:"<<s<<':'<<czy<<"\n";
return czy;
}
vector<int> restore_permutation(int n, int m, int k){
int i, w, j;
for(i=0;i<n;i++)pop[0]+='0';
for(i=0;i<n;i++)pop[1]+='0';
if(n==128)w=7;
if(n==32)w=5;
if(n==8)w=3;
for(i=0;i<w;i++){
for(j=0;j<n;j++){
if((j>>i)&1){
auto &pom = pop[!((j>>(i-1))&1)];
pom[j] = '1';
dodaj1(pom);
pom[j] = '0';
}
}
for(j=0;j<n;j++){
pop[0][j] = pop[1][j] = '0';
if((j>>i)&1)pop[1][j] = '1';
else pop[0][j] = '1';
}
}
compile_set();
for(i=0;i<w;i++){
for(j=0;j<n;j++){
string pom;
bool czy = (liczby[j]>>(i-1))&1;
for(int ij=0;ij<n;ij++)pom+='0'+((liczby[ij]>>(i-1))&1)^czy;
pom[j]='1';
liczby[j]+=(1<<i)*zapytaj1(pom);
}
}
vector<int>p;
for(i=0;i<n;i++)p.push_back(liczby[i]);
return(p);
}
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... |