Submission #569050

#TimeUsernameProblemLanguageResultExecution timeMemory
569050losmi247Unscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n,w,r;

vector <int> prvi(){
    add_element("11110000");
    add_element("11000000");
    add_element("00000011");
    add_element("10000000");
    add_element("00100000");
    add_element("00001000");
    add_element("00000010");

    compile_set();

    vector <int> ret(8,0);
    for(int i = 0; i < 8; i++) ret[i] = i;

    string s = "11110000";
    for(int i = 0; i < 4; i++){
        for(int j = 4; j < 8; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    s = "11000000";
    for(int i = 0; i < 2; i++){
        for(int j = 2; j < 4; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    s = "00000011";
    for(int i = 5; i < 7; i++){
        for(int j = 7; j < 8; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    s = "10000000";
    for(int i = 0; i < 1; i++){
        for(int j = 1; j < 2; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    s = "00100000";
    for(int i = 2; i < 3; i++){
        for(int j = 3; j < 4; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    s = "00001000";
    for(int i = 4; i < 5; i++){
        for(int j = 5; j < 6; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    s = "00000010";
    for(int i = 6; i < 7; i++){
        for(int j = 7; j < 8; j++){
            string h = s;
            swap(h[i],h[j]);
            if(check_element(h)){
                swap(ret[i],ret[j]);
                return ret;
            }
        }
    }

    cout << "kurac" << endl;
    return {};
}

vector <int> restore_permutation(int N,int W,int R){
    n = N;
    w = W;
    r = R;

    if(n == 8 && w == 256 && r == 256){
        return prvi();
    }
}

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> prvi()':
messy.cpp:8:5: error: 'add_element' was not declared in this scope
    8 |     add_element("11110000");
      |     ^~~~~~~~~~~
messy.cpp:16:5: error: 'compile_set' was not declared in this scope
   16 |     compile_set();
      |     ^~~~~~~~~~~
messy.cpp:26:16: error: 'check_element' was not declared in this scope
   26 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp:38:16: error: 'check_element' was not declared in this scope
   38 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp:50:16: error: 'check_element' was not declared in this scope
   50 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp:62:16: error: 'check_element' was not declared in this scope
   62 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp:74:16: error: 'check_element' was not declared in this scope
   74 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp:86:16: error: 'check_element' was not declared in this scope
   86 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp:98:16: error: 'check_element' was not declared in this scope
   98 |             if(check_element(h)){
      |                ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:117:1: warning: control reaches end of non-void function [-Wreturn-type]
  117 | }
      | ^