#include <bits/stdc++.h>
int code[10000];
int ok1 , ok2;
int encode (int N, int x, int y){
int elem , i , aux , cnt;
if (!ok1){
elem = 0;
ok1 = 1;
for (i = 0 ; i < (1 << 12) ; i++){
aux = i;
cnt = 0;
while (aux){
cnt += aux % 2;
aux /= 2;
}
if (cnt == 6)
code[++elem] = i;
}
}
x = code[x];
y = code[y];
for (i = 0 ; i < 12 ; i++){
if (((x & (1 << i)) == 0) && ((y & (1 << i)) != 0))
return i;
}
}
#include <bits/stdc++.h>
int code[10000];
int ok1 , ok2;
int decode (int N, int q, int h){
int elem , i , aux , cnt;
if (!ok2){
elem = 0;
ok2 = 1;
for (i = 0 ; i < (1 << 12) ; i++){
aux = i;
cnt = 0;
while (aux){
cnt += aux % 2;
aux /= 2;
}
if (cnt == 6)
code[++elem] = i;
}
}
q = code[q];
if (q & (1 << h))
return 0;
return 1;
}
Compilation message
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
768 KB |
the encoded value must be greater than or equal to 1 |
2 |
Incorrect |
9 ms |
776 KB |
the encoded value must be greater than or equal to 1 |