# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
943271 | Nika533 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 1 ms | 348 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 GCC diagnostic warning "-std=c++11"
#include "messy.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
// add_element("0");
// compile_set();
// check_element("0");
string s="";
for (int i=0; i<n; i++) s.pb('0');
for (int i=0; i<n; i++) {
s[i]='1';
add_element(s);
}
compile_set();
string arr[n+1];
for (int i=0; i<(1<<n); i++) {
int cnt=0;
string ask="";
for (int j=0; j<n; j++) {
if (i&(1<<j)) cnt++;
if (i&(1<<j)) ask.pb('1');
else ask.pb('0');
}
if (check_element(ask)) arr[cnt]=ask;
}
vector<int> p(n,0);
s="";
for (int i=0; i<n; i++) s.pb('0');
for (int i=1; i<=n; i++) {
string s2=arr[i];
//cout<<i<<" "<<s2<<" "<<s<<endl;
for (int j=0; j<n; j++) {
if (s[j]!=s2[j]) {
//cout<<"IJ "<<i<<" "<<j<<endl;
p[j]=i-1;
s[j]='1';
}
}
}
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... |