Submission #511385

#TimeUsernameProblemLanguageResultExecution timeMemory
511385kevinxiehkUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#ifndef __cplusplus #include <stdbool.h> #endif #ifdef __cplusplus extern "C" { #endif void add_element(char x[]); void compile_set(); bool check_element(char x[]); void restore_permutation(int n, int w, int r, int result[]); #ifdef __cplusplus } #endif // TODO: global variables can be declared here int ans[128]; int idk[128]; char s[128]; int N; void add(int l,int x){ if(x==1)return; for(int i=0;i<N;i++)s[i]='1'; for(int i=l;i<l+x;i++)s[i]='0'; for(int i=l;i<l+x/2;i++){ s[i]='1'; add_element(s); //cout<<s<<'\n'; s[i]='0'; } add(l,x/2); add(l+x/2,x/2); } void check(int l,int x,int a){ //cout<<l<<' '<<x<<' '<<a<<'\n'; //for(int i=0;i<N;i++)cout<<idk[i]<<' ';cout<<'\n'; if(x==1){ //cout<<l<<' '<<a<<'\n'; for(int i=0;i<N;i++)if(idk[i]==a)ans[l]=i; return; } for(int i=0;i<N;i++)s[i]='1'; for(int i=0;i<N;i++)if(idk[i]==a)s[i]='0'; for(int i=0;i<N;i++){ if(idk[i]!=a)continue; s[i]='1'; if(check_element(s))idk[i]=a*2; else idk[i]=a*2+1; s[i]='0'; } check(l,x/2,a*2); check(l+x/2,x/2,a*2+1); } void restore_permutation(int n, int w, int r, int result[]) { // TODO: implementation // example solution that checks if p_1 = 2 // Subtask 1 case 6 and 9 accepted N=n; add(0,n); compile_set(); //for(auto x:ele)cout<<x<<'\n'; for(int i=0;i<n;i++)idk[i]=1; check(0,n,1); for(int i=0;i<n;i++)result[i]=ans[i]; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc467CQ3.o: in function `main':
grader.cpp:(.text.startup+0x19f): undefined reference to `restore_permutation(int, int, int)'
/usr/bin/ld: /tmp/ccl3DzJ2.o: in function `add(int, int)':
messy.cpp:(.text+0xbc): undefined reference to `add_element'
/usr/bin/ld: /tmp/ccl3DzJ2.o: in function `check(int, int, int)':
messy.cpp:(.text+0x1a4): undefined reference to `check_element'
/usr/bin/ld: /tmp/ccl3DzJ2.o: in function `restore_permutation':
messy.cpp:(.text+0x26f): undefined reference to `compile_set'
collect2: error: ld returned 1 exit status