Battle with Upper Moon 6

Easyrubrik

Problem Overview

  • Determine which demons remain alive in an n×m grid after processing kill turns; killing a cell revives all its descendants (children at (i+1, j-1/j/j+1)).
  • Input: T test cases with n, m, and a distinct kill-order matrix K with values 1..n*m; all start alive.
  • Output: n lines of space-separated 0/1 per cell (1 alive, 0 dead); sizes up to 1e3×1e3, total cells ≤ 1e6.
  • Set in Demon Slayer’s Upper Moon 6; a Rubrik interviews coding interview problem and interview question on grid hierarchies and event effects.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: