Submission #1074157

#TimeUsernameProblemLanguageResultExecution timeMemory
1074157beaconmcUnscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include "messy.h"
#include <bits/stdc++.h>

typedef long long ll;

#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(lli = x; i>y; i--)
using namespace std;


ll N;
string idk;
void encode(ll a, ll b){
    if (a==b) return;
    string temp = idk;
    FOR(i,0,N){
        if (!(a<=i && i<=b)) temp[i] = '1';
    }
    ll mid = (a+b)/2;
    FOR(i,a,mid){
        temp[i] = '1';
        add_element(temp);
        temp[i] = '0';
    }
    encode(a, mid);
    encode(mid+1, b;);
}

vector<ll> solve(set<ll> a){
    if (a.size() == 1){
        vector<ll> ans;
        for (auto&i : a) ans.push_back(i);
        return ans;
    }
    string temp = idk;
    set<ll> temp1, temp2;
    FOR(i,0,N) if (a.count(i)==0) temp[i] = '1';
    
    for (auto&i : a){
        temp[i] = '1';
        ll lol = check_element(temp);
        if (lol) temp1.insert(i);
        else temp2.insert(i);
        temp[i] = '0';
    }
    vector<ll> ans1 = solve(temp1);
    vector<ll> ans2 = solve(temp2);
    vector<ll> ans;
    for (auto&i : ans1) ans.push_back(i);
    for (auto&i : ans2) ans.push_back(i);
    return ans;
}

std::vector<int> restore_permutation(int n, int w, int r) {
    N = n;
    FOR(i,0,n) idk += '0';
    encode(0, n-1);
    compile_set();
    set<ll> temp;
    FOR(i,0,n) temp.insert(i);
    return vector<int> decode(temp);


}

Compilation message (stderr)

messy.cpp: In function 'void encode(ll, ll)':
messy.cpp:26:20: error: expected ')' before ';' token
   26 |     encode(mid+1, b;);
      |           ~        ^
      |                    )
messy.cpp:26:21: error: expected primary-expression before ')' token
   26 |     encode(mid+1, b;);
      |                     ^
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:61:24: error: expected primary-expression before 'decode'
   61 |     return vector<int> decode(temp);
      |                        ^~~~~~
messy.cpp:61:23: error: expected ';' before 'decode'
   61 |     return vector<int> decode(temp);
      |                       ^~~~~~~
      |                       ;
messy.cpp:61:24: error: 'decode' was not declared in this scope; did you mean 'encode'?
   61 |     return vector<int> decode(temp);
      |                        ^~~~~~
      |                        encode