A complete and deterministic solution to the GF(2) bitplane decoding challenge
In this Nintendo Open Contest problem, an encoded message is provided as a sequence of hexadecimal values representing a binary polynomial over GF(2).
The task is to decode this message by finding all valid decoded values that satisfy a specific algebraic relationship — and to present them exactly as required by the judge.
This is not a “find one answer” problem.
It is a find all valid answers problem.
You are given a polynomial P(x) encoded as two S-bit planes.
Your goal is to find every pair of polynomials:
A(x), B(x)
such that:
A(x) · B(x) = P(x) (over GF(2))
with the constraints:
deg(A) < Sdeg(B) < S
If more than one decoded value exists, all must be printed, in the correct order.
CENTAURI solves this problem by working directly in the algebra of GF(2).
At a high level, the program:
- Interprets the input as a polynomial over GF(2)
- Factorizes the polynomial into irreducible components
- Enumerates all valid factor pairings that respect the degree limits
- Verifies each candidate locally
- Outputs the results in the required canonical order
This guarantees:
- Completeness — no valid decoded value is missed
- Correctness — no invalid value is printed
- Determinism — the same input always produces the same output
S < S/16 hexadecimal 32-bit words >
0 < S ≤ 256Sis a multiple of 32- The input encodes exactly
2Sbits, least-significant bit first
Each line represents one valid decoded value:
A0 A1 … A(L−1) B0 B1 … B(L−1)
where L = S / 32.
- Lowercase hexadecimal
- Zero-padded to 8 digits
- Ordered exactly as expected by the contest judge
- All valid decoded values are printed
- Results are sorted deterministically
- Duplicate outputs are removed
- When the encoded polynomial has degree
< S, the trivial decoded values
(1, P)and(P, 1)are also included — matching official reference outputs
g++ -O2 -std=c++17 centauri.cpp -o centauri
./centauri < input.txt
⸻
🏁 Final Notes
• No randomness
• No floating point arithmetic
• No undefined behavior
• Fixed memory footprint
• Fully self-verifying
This submission was validated against all provided test cases.
⸻
📄 License
MIT License
© 2025 Antonio Torquato