Submission #732188

# Submission time Handle Problem Language Result Execution time Memory
732188 2023-04-28T15:35:51 Z vjudge1 Unscrambling a Messy Bug (IOI16_messy) C++17
0 / 100
1 ms 260 KB
#include "messy.h"
#include<bits/stdc++.h>
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
#define lastbit(i) __builtin_ctz(i)
int n;
void add(int l,int r){
string temp;
for1(i,0,n-1){
temp.pb('1');
}
for1(j,l,r){
temp[j]=0;
}
for1(j,l,(l+r)/2){
temp[j]=1;
add_element(temp);
temp[j]=0;
}
int mid=(l+r)/2;
add(l,mid);
add(mid+1,r);
}
int p[128];
int turn[128];
void solve(int l,int r,vector<int>can){
if (l==r){
    p[l]=can[0];
    return;
}
memset(turn,0,sizeof(turn));
for(auto v:turn){
    can[v]=1;
}
string temp;
for1(i,0,n-1){
if (turn[i])temp.pb('0');
else temp.pb('1');
}
vector<int>cl,cr;
for(auto v:can){
temp[v]=1;
bool fl=check_element(temp);
temp[v]=0;
if (fl){
    cl.pb(v);
}
else {
    cr.pb(v);
}
}
int mid=(l+r)/2;
solve(l,mid,cl);
solve(mid+1,r,cr);
}
vector<int>restore_permutation(int N,int w,int r){
n=N;
add(0,n-1);
compile_set();
vector<int>can;
for1(i,0,n-1){
can.pb(i);
}
solve(0,n-1,can);
vector<int>ans;
for1(i,0,n-1){
ans.pb(p[i]);
}
return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 260 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -