제출 #1207143

#제출 시각아이디문제언어결과실행 시간메모리
1207143lovrot질문 (CEOI14_question_grader)C++20
0 / 100
7095 ms15396 KiB
#include <cstdio> using namespace std; namespace A { const int N = 1e3; const int LOG = 12; int mask[N]; int bitperm(int x, int k) { int ret = x + (x & -x); return ret + (1 << (k - __builtin_popcount(ret))) - 1; } void give_mask() { int x = (1 << (LOG / 2)) - 1; for(int i = 1; i <= 924; ++i) { mask[i] = x; if(i == 924) return; x = bitperm(x, LOG / 2); } } } int encode(int n, int x, int y) { using namespace A; give_mask(); for(int i = 0; i < LOG; ++i) { if(!(mask[x] & (1 << i)) && (mask[y] & (1 << i))) { return i + 1; } } return 0; }
#include <cstdio> using namespace std; namespace B { const int N = 1e3; const int LOG = 12; int mask[N]; int bitperm(int x, int k) { int ret = x + (x & -x); return ret + (1 << (k - __builtin_popcount(ret))) - 1; } void give_mask() { int x = (1 << (LOG / 2)) - 1; for(int i = 1; i <= 924; ++i) { mask[i] = x; if(i == 924) return; x = bitperm(x, LOG / 2); } } } int decode(int n, int x, int h) { using namespace B; give_mask(); return (bool) (mask[x] & (1 << (h - 1))); }
#Verdict Execution timeMemoryGrader output
Fetching results...