int N = 920, cnt, ba[930];
bool fl=1;
int dfs(int ix, int c0, int c1, int su){
if(ix==12){ ba[cnt++]=su; return; }
if(c0) dfs(ix+1, c0-1, c1, su);
if(c1) dfs(ix+1, c0, c1-1, su|(1<<ix));
}
void init(){
dfs(0, 6, 6, 0);
}
int encode (int n, int x, int y) {
if(fl)init(), fl=0;
for(int i=0; i<12; i++){
if((ba[x-1] & (1<<i)) && (ba[y-1] & (1<<i))==0) return i+1;
}
return 0;
}
int N = 920, cnt, ba[930];
bool fl=1;
int dfs(int ix, int c0, int c1, int su){
if(ix==12){ ba[cnt++]=su; return; }
if(c0) dfs(ix+1, c0-1, c1, su);
if(c1) dfs(ix+1, c0, c1-1, su|(1<<ix));
}
void init(){
dfs(0, 6, 6, 0);
}
int decode (int n, int q, int h) {
if(fl)init(), fl=0;
return (ba[q-1] & (1<<(h-1))) ? 1 : 0;
}
Compilation message
encoder.cpp: In function 'int dfs(int, int, int, int)':
encoder.cpp:5:28: error: return-statement with no value, in function returning 'int' [-fpermissive]
if(ix==12){ ba[cnt++]=su; return; }
^
decoder.cpp: In function 'int dfs(int, int, int, int)':
decoder.cpp:5:28: error: return-statement with no value, in function returning 'int' [-fpermissive]
if(ix==12){ ba[cnt++]=su; return; }
^