TCCC '24 Jan P2 - Hamlet the Frightening

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 128M

Author:
Problem type

“Ophelia: Alas, my lord, I have been so affrighted!

Polonius: With what, i’ the name of heaven?

Ophelia: My lord, as I was sewing in my chamber, Lord Hamlet, with his doublet all unbraced, No hat upon his head, his stockings foul’d, Ungarter’d and down-gyved to his ancle: Pale as his shirt, his knees knocking each other, and with a look so piteous in purport, as if he had been loosed out of hell to speak of horrors, he comes before me” (Shakespeare, 2.1.76-85).

After Hamlet listens to the ghost, without question, he decides to investigate the validity of what the ghost says. This fact alone is a solid indicator that he lacks mental stability, completely ignoring the fact that a ghost has appeared in front of him without question. Since the Id represents a lack of logic, we can conclude through this illogical action from Hamlet, that his id currently overshadows his superego as he struggles to come to terms with his father's death.

The fact that Hamlet only takes in that Claudius could be the murderer of his father shows the development of revenge. Hamlet’s id is proven more prominent as he projects his sadness and anger toward those around him. An example of this is Ophelia, Hamlet’s love interest. His plan to fake madness to hide his investigation subconsciously is a way for him to project negative emotions on Ophelia. We see this through Ophelia’s negative mood change after meeting him.

Ophelia needs to travel between different rooms for her own business. She does not want to meet Hamlet as he spreads negativity, so she purchases a device that scans for specific people through the wall. Unfortunately, she cannot comprehend the data the device returns as it is a jumble of characters. Your job is to create a program to translate this data into understandable Shakespearean English. The manufacturer has included instructions to determine if a specific person (Hamlet) is inside the room.

If the sequence of characters below appears, then Hamlet is in the room (Note the . character can be any character)

.@.
###
.#.
#.#

Input Specifications

This first line contains Integer N (1 \le N \le 10), the number of rooms to check.

The next N lines consist of integers R and C, the room dimensions where (4 \le R \le 10^3) and (3 \le C \le 10^3).

The next R lines of length C consist of a character in the English alphabet or ., #, and @.

Output Specifications

If Hamlet is found in the scan, output HAMLET!, else CLEAR!

Subtasks

Subtask 1 [30%]:

  • R = 4
  • C = 3

Subtask 2 [70%]:

  • No further constraints

Sample input 1

1
4 3
.@.
###
.#.
#.#

Sample output 1

HAMLET!

Sample input 2

1
4 3
.O.
###
.#.
#.#

Sample output 2

CLEAR!

Comments

There are no comments at the moment.