#P9416. [POI 2021/2022 R1] Domino
[POI 2021/2022 R1] Domino
Background
Translated from XXIX Olimpiada Informatyczna – Stage I Domino。
Problem Description
There is a -row, -column rectangle, where some cells are blocked. You need to use or dominoes to cover all unblocked cells, and no cell may be covered twice. Let the number of ways be .
Given , find the smallest such that there exists a way to choose the blocked cells so that the number of tilings is exactly . If there is no solution, output NIE.
Input Format
One line with a positive integer 。
Output Format
If there is a solution, output your answer 。
If there is no solution, output NIE。
4
5
101
NIE
9
7
11
NIE
500
20
112233445566778899
NIE
Hint
For all testdata, 。
Constraints
| Subtask ID | Additional Constraints | Score |
|---|---|---|
| 1 | Answer | 20 |
| 2 | 30 | |
| 3 | 50 |
Translated by ChatGPT 5