Submission #25927

#TimeUsernameProblemLanguageResultExecution timeMemory
25927imsifileQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++98
100 / 100
1935 ms25684 KiB
int N = 920, cnt, ba[930]; bool fl=1; void 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; void 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...