Submission #308962

#TimeUsernameProblemLanguageResultExecution timeMemory
308962amunduzbaevUnscrambling 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<int>ans;
int n1;

void add(int l,int r){
    string s(n1,'1');
    for(int i = l ; i <= r ;i++) s[i]='0';
    int m = (l+r)/2;
    for( int  i = l ; i <= m; i++){
        s[i]='1';
        add_element(s);
        s[i]='0';
    }
    if(l!=m)   add(l, m);
    if(m+1!=r) add(m+1, r);
    return;
}
void check(int l,int r,vector<int> v){
    if(l==r){
         ans[v[0]] = l;
         return ;
    }

    string s(n1,'1');
    for(int i=0;i<v.size() ;i++)
        s[v[i]]='0';

    vector <int> vl, vr;
    int m=(l+r)/2;

    for(int i = l ; i <= r; i++){
        s[v[i-l]]='1';
        if(check_element(s))   vl.push_back(v[i-l]);
        else                   vr.push_back(v[i-l]);
        s[v[i-l]]='0';
    }
    check(l,m,vl);
    check(m+1,r,vr);
}
vector<int> restore_permutation(int N, int w, int r) {
    n1=N;
    add(0,n1-1);
    compile_set();

    vector<int>v;

    v.resize(n1);
    ans.resize(n1);

    for(int i=0;i<n1;i++)
        v[i]=i;
    check(0,n1-1,v);

    return ans;
}
/*

4
16 16
1 3 2 0

*/

Compilation message (stderr)

messy.cpp: In function 'void check(int, int, std::vector<int>)':
messy.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for(int i=0;i<v.size() ;i++)
      |                 ~^~~~~~~~~
/tmp/ccDkbNti.o: In function `helper::read_int()':
grader.cpp:(.text+0x0): multiple definition of `helper::read_int()'
/tmp/ccwaHx0a.o:messy.cpp:(.text+0x0): first defined here
/tmp/ccDkbNti.o: In function `get_p(int)':
grader.cpp:(.text+0x50): multiple definition of `get_p(int)'
/tmp/ccwaHx0a.o:messy.cpp:(.text+0x50): first defined here
/tmp/ccDkbNti.o:(.bss+0x10): multiple definition of `helper::p'
/tmp/ccwaHx0a.o:(.bss+0x30): first defined here
/tmp/ccDkbNti.o: In function `wa()':
grader.cpp:(.text+0x70): multiple definition of `wa()'
/tmp/ccwaHx0a.o:messy.cpp:(.text+0x70): first defined here
/tmp/ccDkbNti.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccwaHx0a.o:messy.cpp:(.text.startup+0x0): first defined here
/tmp/ccDkbNti.o:(.bss+0x28): multiple definition of `helper::n'
/tmp/ccwaHx0a.o:(.bss+0x48): first defined here
/tmp/ccDkbNti.o:(.bss+0x4): multiple definition of `helper::w'
/tmp/ccwaHx0a.o:(.bss+0x2c): first defined here
/tmp/ccDkbNti.o:(.bss+0x0): multiple definition of `helper::r'
/tmp/ccwaHx0a.o:(.bss+0x28): first defined here
/tmp/ccDkbNti.o:(.bss+0x2c): multiple definition of `helper::compiled'
/tmp/ccwaHx0a.o:(.bss+0x4c): first defined here
/tmp/ccDkbNti.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/ccwaHx0a.o:messy.cpp:(.text+0xa0): first defined here
/tmp/ccDkbNti.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/ccwaHx0a.o:messy.cpp:(.text+0xf0): first defined here
/tmp/ccDkbNti.o:(.bss+0x40): multiple definition of `helper::set_[abi:cxx11]'
/tmp/ccwaHx0a.o:(.bss+0x60): first defined here
/tmp/ccDkbNti.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/ccwaHx0a.o:messy.cpp:(.text+0x670): first defined here
/tmp/ccDkbNti.o: In function `compile_set()':
grader.cpp:(.text+0x2b0): multiple definition of `compile_set()'
/tmp/ccwaHx0a.o:messy.cpp:(.text+0x830): first defined here
collect2: error: ld returned 1 exit status