답안 #97032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97032 2019-02-13T12:26:57 Z Kastanda 질문 (CEOI14_question_grader) C++11
100 / 100
1633 ms 78800 KB
// And I was like ooo-eee-ooo
#include<bits/stdc++.h>
using namespace std;
const int MXN = 4095;
vector < int > A;
inline int Init()
{
    for (int i = 0; i <= MXN; i++)
        if (__builtin_popcount(i) == 6)
            A.push_back(i);
}
int encode(int N, int X, int Y)
{
    if (!A.size()) Init();
    return (__builtin_ctz(A[X] & (MXN ^ A[Y])) + 1);
}
// White tiger's like ooo-aaa--oooo
#include<bits/stdc++.h>
using namespace std;
const int MXN = 4095;
vector < int > A;
inline int Init()
{
    for (int i = 0; i <= MXN; i++)
        if (__builtin_popcount(i) == 6)
            A.push_back(i);
}
int decode(int N, int Q, int H)
{
    if (!A.size()) Init();
    return (A[Q] & (1 << H - 1)) > 0;
}

Compilation message

encoder.cpp: In function 'int Init()':
encoder.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^

decoder.cpp: In function 'int Init()':
decoder.cpp:11:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:15:28: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
     return (A[Q] & (1 << H - 1)) > 0;
                          ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1478 ms 78784 KB Output is correct - maxh = 12
2 Correct 1633 ms 78800 KB Output is correct - maxh = 12