답안 #230110

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
230110 2020-05-08T12:23:50 Z Ruxandra985 질문 (CEOI14_question_grader) C++14
100 / 100
4019 ms 48272 KB
#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 + 1;
 
    }
 
}
#include <bits/stdc++.h>
 
int code[10000];
 
int ok1 , ok2;
 
int decode (int N, int q, int h){
 
    int elem , i , aux , cnt;
  
  h--;
 
    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 Correct 4019 ms 48272 KB Output is correct - maxh = 12
2 Correct 3949 ms 48248 KB Output is correct - maxh = 12