Submission #308945

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

#include "messy.h"
#include "grader.cpp"

vector<string>v;
int n1;

string bin(int a){
    string s;
    while(a){
        int d=a%2;
        s.push_back(d+'0');
        a/=2;
    }
    int ss=s.size();
    while(ss < n1){
        s.push_back('0');
        ss=s.size();
    }

    reverse(s.begin(),s.end());
    return s;
}

void add(){
    string s(n1,'0');
    s[0]='0';
    for(int i=1;i<n1;i++) s[i]='1';
    int last=1;
    for(int i=0;i<n1-1;i++){
        add_element(s);
        s[last]='0';
        last++;
    }
    //cout<<"worked\n";
}
int fun(int b){
    int a=1;
    while(b--) a*=2;
    return a;
}
void check(){
    int num=0;
    string s;
    int n2=fun(n1);
    for(int i=1;i<n2;i++){
        num++;
        s=(bin(num));
        if(check_element(s)) v.push_back(s);
    }
}
vector<int> restore_permutation(int N, int w, int r) {
    n1=N;
    add();
    compile_set();
    check();
    int vs=v.size();
    vector<int>ans(n1,0),a(n1,0);
    for(int i=0;i<vs;i++){
        for(int j=0;j<n1;j++){
            a[j]+=(v[i][j]-'0');
        }
    }
    //for(int i=0;i<n1;i++){
    //    ans[a[i]]=i;
    //}
    //for(int i=0;i<n1;i++)
    //    cout<<a[i]<<" ";
    return a;
}
/*

4
16 16
1 3 2 0

*/

Compilation message (stderr)

/tmp/ccy7lqxO.o: In function `helper::read_int()':
grader.cpp:(.text+0x0): multiple definition of `helper::read_int()'
/tmp/ccIeA66E.o:messy.cpp:(.text+0x0): first defined here
/tmp/ccy7lqxO.o: In function `get_p(int)':
grader.cpp:(.text+0x50): multiple definition of `get_p(int)'
/tmp/ccIeA66E.o:messy.cpp:(.text+0x50): first defined here
/tmp/ccy7lqxO.o:(.bss+0x10): multiple definition of `helper::p'
/tmp/ccIeA66E.o:(.bss+0x30): first defined here
/tmp/ccy7lqxO.o: In function `wa()':
grader.cpp:(.text+0x70): multiple definition of `wa()'
/tmp/ccIeA66E.o:messy.cpp:(.text+0x70): first defined here
/tmp/ccy7lqxO.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccIeA66E.o:messy.cpp:(.text.startup+0x0): first defined here
/tmp/ccy7lqxO.o:(.bss+0x28): multiple definition of `helper::n'
/tmp/ccIeA66E.o:(.bss+0x48): first defined here
/tmp/ccy7lqxO.o:(.bss+0x4): multiple definition of `helper::w'
/tmp/ccIeA66E.o:(.bss+0x2c): first defined here
/tmp/ccy7lqxO.o:(.bss+0x0): multiple definition of `helper::r'
/tmp/ccIeA66E.o:(.bss+0x28): first defined here
/tmp/ccy7lqxO.o:(.bss+0x2c): multiple definition of `helper::compiled'
/tmp/ccIeA66E.o:(.bss+0x4c): first defined here
/tmp/ccy7lqxO.o: In function `check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
grader.cpp:(.text+0xa0): multiple definition of `check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/ccIeA66E.o:messy.cpp:(.text+0xa0): first defined here
/tmp/ccy7lqxO.o: In function `check_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0xf0): multiple definition of `check_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccIeA66E.o:messy.cpp:(.text+0xf0): first defined here
/tmp/ccy7lqxO.o:(.bss+0x40): multiple definition of `helper::set_[abi:cxx11]'
/tmp/ccIeA66E.o:(.bss+0x60): first defined here
/tmp/ccy7lqxO.o: In function `add_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x250): multiple definition of `add_element(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/ccIeA66E.o:messy.cpp:(.text+0x630): first defined here
/tmp/ccy7lqxO.o: In function `compile_set()':
grader.cpp:(.text+0x2b0): multiple definition of `compile_set()'
/tmp/ccIeA66E.o:messy.cpp:(.text+0x7a0): first defined here
collect2: error: ld returned 1 exit status