const int N=1000;
int ff1[N][12],tsz1=0;
bool enc=true;
int encode(int n,int x,int y) {
if (enc) {
enc=false;
for (int i=0;i<(1<<12);i++) if (__builtin_popcount(i)==6) {
++tsz1;
for (int j=0;j<12;j++) if (i>>j&1) ff1[tsz1][j]=1;
}
}
for (int i=0;i<12;i++) if (ff1[x][i]&&!ff1[y][i]) return i+1;
return 12;
}
const int N=1000;
int ff2[N][12],tsz2;
bool dec=true;
int decode(int n,int q,int h) {
if (dec) {
dec=false;
for (int i=0;i<(1<<12);i++) if (__builtin_popcount(i)==6) {
++tsz2;
for (int j=0;j<12;j++) if (i>>j&1) ff2[tsz2][j]=1;
}
}
return ff2[q][h-1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4290 ms |
24096 KB |
Output is correct - maxh = 12 |
2 |
Correct |
4256 ms |
24268 KB |
Output is correct - maxh = 12 |