Submission #36524

#TimeUsernameProblemLanguageResultExecution timeMemory
36524cheater2kQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
1816 ms27480 KiB
#include <bits/stdc++.h> using namespace std; namespace A { int mp[960]; bool called; // check whether function build() was called // map i (1 <= i <= 920) with a 12-bit integer j such that __builtin_popcount(j) = 6 void build() { int cur = 0; for (int mask = 0; mask < (1 << 12); ++mask) { if (__builtin_popcount(mask) == 6) { mp[++cur] = mask; } } } }; int encode (int n, int x, int y) { if (!A::called) A::called = true, A::build(); int X = A::mp[x], Y = A::mp[y]; for (int i = 0; i < 12; ++i) { int bitX = (X >> i & 1); int bitY = (Y >> i & 1); if (!bitX && bitY) { // the i-th bit of X is 0 while that of Y is 1 return i + 1; } } }
#include <bits/stdc++.h> using namespace std; namespace B { // similar to namespace A int mp[960]; bool called; // check whether function build() was called // map i (1 <= i <= 920) with a 12-bit integer j such that __builtin_popcount(j) = 6 void build() { int cur = 0; for (int mask = 0; mask < (1 << 12); ++mask) { if (__builtin_popcount(mask) == 6) { mp[++cur] = mask; } } } }; int decode (int n, int q, int h) { // X and Y is different at h-th bit if (!B::called) B::called = true, B::build(); int Q = B::mp[q]; --h; int bitQ = Q >> h & 1; if (!bitQ) return true; else return false; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...