generated from OPCODE-Open-Spring-Fest/template
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13caeba
commit e8d1595
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Once Bluemin decided to adorn his living room with a tessellated floor. | ||
The living room boasts dimensions n x m meters. | ||
Bluemin had at his disposal planks of three varieties: | ||
-a planks measuring 1 x 2 meters, | ||
-b planks measuring 2 x 1 meters, | ||
-c planks measuring 2 x 2 meters. | ||
|
||
Your task is to aid Bluemin in determining whether it's feasible to embellish the living room with such a collection of planks. If possible, you should provide one potential arrangement. | ||
|
||
Input: | ||
The initial line presents 5 space-separated integers: n , m , a , b , and c ( 1 ≤ n, m ≤ 100 , 0 ≤ a, b, c ≤ 10^4 ). Here, n and m denote the living room dimensions, while a , b , and c represent the quantities of planks measuring 1 x 2 , 2 x 1 , and 2 x 2 meters respectively. It's imperative not to rotate the planks. | ||
|
||
Output: | ||
If it proves impossible to adorn the room with the given set of planks, you should output "IMPOSSIBLE". Otherwise, you should provide one potential arrangement, consisting of n lines with m lowercase Latin letters each. Adjacent squares containing the same letter signify that they belong to the same plank. If the answer isn't unique, any valid arrangement will suffice. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Examples | ||
|
||
input | ||
2 6 2 2 1 | ||
|
||
output | ||
aabcca | ||
aabdda | ||
|
||
input | ||
1 1 100 100 100 | ||
|
||
output | ||
IMPOSSIBLE | ||
|
||
input | ||
4 4 10 10 10 | ||
|
||
output | ||
aabb | ||
aabb | ||
bbaa | ||
bbaa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//write your code here |