← All problemsSign in

Finding the matrix

CodeChefRating 2856Open on judge ↗

You are given a matrix B with size N × N. Each element of this matrix is an integer from the set {-1, 0, 1}. Determine if it's possible to express B as A · AT, where A is a matrix of integers with size N × N. (Here, AT is the transpose of A; see below for its definition.) If it is possible, find the lexicographically smallest A such that B = A · AT. The transpose of a matrix is created by flippi

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start