# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132736 | wilwxk | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 5 ms | 504 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;
const int MAXN=2048;
void adiciona(vector<int> &v) {
string cur;
for(int i=0; i<v.size(); i++) cur+=('0'+v[i]);
add_element(cur);
}
bool checa(vector<int> &v) {
string cur;
for(int i=0; i<v.size(); i++) cur+=('0'+v[i]);
return check_element(cur);
}
vector<int> restore_permutation(int n, int w, int r) {
vector<int> conf, respf; respf.resize(n);
for(int i=0; i<n; i++) conf.push_back(0);
for(int i=0; i<n; i++) {
conf[i]=1;
adiciona(conf);
}
compile_set();
for(int i=0; i<n; i++) conf[i]=0;
for(int i=0; i<n; i++) {
bool ok=0;
set<int> ruins;
while(1) {
int j=rand()%n;
if(conf[j]||ruins.find(j)!=ruins.end()) continue;
conf[j]=1;
if(checa(conf)) {
ok=1;
respf[j]=i;
break;
}
ruins.insert(j);
conf[j]=0;
}
}
return respf;
}
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... |