← CSES Better

3xN Tiling

INOI · 2020 · Indian National Olympiad in Informatics · INOI2002

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

tiling · dynamic-programming · profile-dp

The organizer’s problem statement is available at the official source link.

tiling frontier

Only the unfinished frontier affects the next column

Tiles span up to three columns, so a column mask records cells already occupied by tiles extending from the left.

Problem grid; highlighted cells show the illustrated path
AAB
AAB
CCB
  1. 1

    Track the open cells

    Process the floor column by column with a mask of incoming occupied cells.
  2. 2

    Place a legal tile

    Try every legal tile placement that covers the first uncovered cell without overlap or leaving the floor.
  3. 3

    Count completed floors

    Sum ways reaching the final empty frontier modulo 1,000,000,007.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 chars

Run output

Run your code to see output.