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;
const int N=205;
int arr[N];
string ss;
void add(int l, int r) {
if (l==r) return;
int mid=(l+r)/2;
string s=ss;
for (int i=l; i<=r; i++) s[i]='0';
for (int i=l; i<=mid; i++) {
s[i]='1';
add_element(s);
s[i]='0';
}
add(l,mid); add(mid+1,r);
}
void check(int l, int r, vector<int> c) {
if (l==r) {
arr[c[0]]=l;
return;
}
int mid=(l+r)/2;
string s=ss;
for (auto a:c) s[a]='0';
vector<int> c1,c2;
for (auto a:c) {
s[a]='1';
if (check_element(s)) c1.pb(a);
else c2.pb(a);
s[a]='0';
}
check(l,mid,c1); check(mid+1,r,c2);
}
vector<int> restore_permutation(int n, int w, int r) {
vector<int> c;
for (int i=0; i<n; i++) ss.pb('1');
for (int i=0; i<n; i++) c.pb(i);
add(0,n-1);
compile_set();
check(0,n-1,c);
vector<int> p;
for (int i=0; i<n; i++) p.pb(arr[i]);
return p;
}
Compilation message (stderr)
messy.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
1 | #pragma GCC diagnostic warning "-std=c++11"
| ^~~~~~~~~~~~
# | 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... |