NITT4 - Tiles
Given a N x M floor with few blocks already filled, check if it is possible to fill the remaining space with only 2 x 1 blocks, if it is not possible, print the minimum number of 1 x 1 blocks required to fill the floor completely.
First line contains N (number of rows), M (number of columns), B (number of already blocked cells), followed by B lines each containing 2 integers x, y coordinates of the blocked cell
1 <= N <= 100, 1 <= M <= 100, 0 <= B <= N*M
If it is possible to fill the floor with only 2 x 1 tiles, print Yes, else print No and the minimum number of 1 x 1 tiles required.
Input: 1 1 0
Output: No 1
2 2 0
2 2 2
@Jacob Plachta: Thanks for clarifying!
1. The coordinates of the blocked cells are given as (row, column).
【【orz @nblt & @dhy007!!!!!!!!】】
I think it's not clear whether we must print (1) number of 1x1 blocks required in order to make the floor tileable by 1x2 blocks (2) number of 1x1 blocks required simply to fill the floor. Problem is worded implying (2), but since it's a trivial calculation (once we have decided "No"), maybe (1) is desired.
Ricardo Oliveira [UFPR]:
Can 2X1 tiles be placed like 1X2 tiles, horizontally ?
|Cluster:||Cube (Intel G860)|
|Languages:||All except: ASM32-GCC MAWK BC C-CLANG CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET|