int T0, E0[924][12];
int encode (int n, int x, int y) {
if (T0 == 0) {
for (int i = 0; i < 4096; i++) {
int bit[12]; for (int j = 0; j < 12; j++) bit[j] = (i / (1 << j)) % 2;
int cnt = 0;
for (int j = 0; j < 12; j++) cnt += bit[j];
if (cnt == 6) {
for (int j = 0; j < 12; j++) E0[T0][j] = bit[j];
T0++;
}
}
}
for (int i = 0; i < 12; i++) {
if (E0[x][i] == 1 && E0[y][i] == 0) return i;
}
}
int T1 = 0, E1[924][12];
int decode (int n, int q, int h) {
if (T1 == 0) {
for (int i = 0; i < 4096; i++) {
int bit[12]; for (int j = 0; j < 12; j++) bit[j] = (i / (1 << j)) % 2;
int cnt = 0;
for (int j = 0; j < 12; j++) cnt += bit[j];
if (cnt == 6) {
for (int j = 0; j < 12; j++) E1[T1][j] = bit[j];
T1++;
}
}
}
return E1[q][h];
}
Compilation message
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
776 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
768 KB |
Output isn't correct |