# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711423 | Jovan26 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 1 ms | 340 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 <bits/stdc++.h>
#include "messy.h"
using namespace std;
#define pb push_back
void display(vector<string> v){
for(auto u:v){
cout<<u<<" ";
}
cout<<endl;
}
std::vector<int> restore_permutation(int n, int w, int r) {
// vector<string> v;
int tr = 1;
for(int i=0;i<n-1;i++){
string s = "";
for(int j=0;j<tr;j++){
s.pb('1');
}
for(int j=tr;j<n;j++){
s.pb('0');
}
//v.pb(s);
add_element(s);
tr++;
}
compile_set();
//cout<<'x'<<endl;
int pp[n] = {};
for(int i=1;i<n;i++){
string s = "";
for(int j=0;j<n;j++) s.pb('1');
for(int j=0;j<n;j++){
if(pp[j]) s[j] = '0';
}
vector<int> ind;
for(int j=0;j<n;j++){
if(s[j]=='1') ind.pb(j);
}
for(int j=0;j<ind.size();j++){
s[ind[j]] = '0';
bool x = check_element(s);
//if(i==1 && x) cout<<s<<endl;
if(x){
pp[ind[j]] = n-i;
break;
}
s[ind[j]] = '1';
}
}
//or(int i=0;i<n;i++) cout<<pp[i]<<" ";
vector<int> p(n,0);
//p.resize(n);
for(int i=0;i<n;i++){
p[i] = pp[i];
}
//display(p);
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... |