Submission #258419

#TimeUsernameProblemLanguageResultExecution timeMemory
258419fivefourthreeoneUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
gpu_hash_table<int, int> mp;
#define ordered_set tree<ttgl, null_type,less<ttgl>, rb_tree_tag,tree_order_statistics_node_update>
 */
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
int ans[128];
void place(int l, int r) {
    string s;
    owo(i, 0, n) {
        if(i>=l&&i<=r) {
            s+='1';
        }else {
            s+='0';
        }
    }
    int mid = (l+r)/2;
    owo(i, l, mid+1) {
        s[i] = '0';
        add_element(s);
        s[i] = '1';
    }
    place(l, mid);
    place(mid+1, r);
}
void solve(int l, int r) {
    string s;
    owo(i, 0, n) {
        if(i>=l&&i<=r) {
            s+='1';
        }else {
            s+='0';
        }
    }
    int mid = (l+r)/2;
    owo(i, l, mid+1) {
        s[i] = '0';
        if(!check_element(s)) {
            int k = ans[r-i+l];
            ans[r-i+l] = ans[i];
            ans[i] = k;
        }
        s[i] = '1';
    }
}
void restore_permutation(int N, int w, int r, int* result) {
    n = N;
    owo(i, 0, n) {
        ans[i] = i;
    }
    place(0, n-1);
    compile_set();
    solve(0, n-1);
    owo(i, 0, n) {
        result[i] = ans[i];
    }
}
/*int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    return 0;
}*/

Compilation message (stderr)

messy.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("O3")
 
messy.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization ("unroll-loops")
 
messy.cpp: In function 'void place(int, int)':
messy.cpp:34:15: error: 'n' was not declared in this scope
     owo(i, 0, n) {
               ^
messy.cpp:5:38: note: in definition of macro 'owo'
 #define owo(i,a, b) for(int i=(a);i<(b); ++i)
                                      ^
messy.cpp:44:9: error: 'add_element' was not declared in this scope
         add_element(s);
         ^~~~~~~~~~~
messy.cpp: In function 'void solve(int, int)':
messy.cpp:52:15: error: 'n' was not declared in this scope
     owo(i, 0, n) {
               ^
messy.cpp:5:38: note: in definition of macro 'owo'
 #define owo(i,a, b) for(int i=(a);i<(b); ++i)
                                      ^
messy.cpp:62:13: error: 'check_element' was not declared in this scope
         if(!check_element(s)) {
             ^~~~~~~~~~~~~
messy.cpp: In function 'void restore_permutation(int, int, int, int*)':
messy.cpp:71:5: error: 'n' was not declared in this scope
     n = N;
     ^
messy.cpp:76:5: error: 'compile_set' was not declared in this scope
     compile_set();
     ^~~~~~~~~~~