답안 #668507

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
668507 2022-12-04T02:44:36 Z RambaXGorilla 질문 (CEOI14_question_grader) C++17
0 / 100
7000 ms 5852 KB
using namespace std;

int conv(int a){
    for(int i = 0, j = 0;i < 1 << 12;i++){
        if(__builtin_popcount(i) == 6){
            j++;
            if(j == a) return i;
        }
    }
}

int encode(int N, int X, int Y){
    X = conv(X);
    Y = conv(Y);
    return __builtin_ctz(X ^ (X & Y)) + 1;
}

int decode(int N, int Q, int H){
    return (bool) (conv(Q) & 1 << H - 1);
}
using namespace std;

int conv(int a){
    for(int i = 0, j = 0;i < 1 << 12;i++){
        if(__builtin_popcount(i) == 6){
            j++;
            if(j == a) return i;
        }
    }
}

int encode(int N, int X, int Y){
    X = conv(X);
    Y = conv(Y);
    return __builtin_ctz(X ^ (X & Y)) + 1;
}

int decode(int N, int Q, int H){
    return (bool) (conv(Q) & 1 << H - 1);
}

Compilation message

encoder.cpp: In function 'int decode(int, int, int)':
encoder.cpp:19:37: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   19 |     return (bool) (conv(Q) & 1 << H - 1);
      |                                   ~~^~~
encoder.cpp: In function 'int conv(int)':
encoder.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
   10 | }
      | ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:19:37: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   19 |     return (bool) (conv(Q) & 1 << H - 1);
      |                                   ~~^~~
decoder.cpp: In function 'int conv(int)':
decoder.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
   10 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 7037 ms 5804 KB Time limit exceeded
2 Execution timed out 7075 ms 5852 KB Time limit exceeded