Limits 1s, 512 MB

Context: An escape room, also known as an escape game or puzzle room, is an immersive challenge where participants collaborate to unravel clues and complete tasks within a themed environment. The goal is to achieve a specific objective within a time limit, often escaping from scenarios like castles, space stations, or ancient pyramids. Despite the name, players are never truly confined, and any threats are fictional. A Game Master manages the experience, setting up the room, explaining rules, and providing hints. These adventures promote teamwork and critical thinking and are popular in settings ranging from Victorian apartments to futuristic realms.
The Story: Our story unfolds with three intelligent friends: Alim, Shanto and Khalid. Eager to embark on an adventure of epic proportions, they find themselves immersed in a puzzle game of a different kind. Little do they know, the game's virtual arena holds the key to the ultimate test of their skills and resilience.

As the game begins, Alim, Shanto, and Khalid are trapped in a mysterious room. As the door closes, their only hope is to unravel the mysterious riddles that lie before them. Each puzzle solved brings them one step closer to freedom, while failure means an eternity trapped in this room.

As time passes, Alim, Shanto, and Khalid must rely on their collective wits and problem-solving abilities to decipher the mysterious clues scattered throughout the room. Each twist and turn reveals new challenges, each more confusing than the last.

Will they be able to escape the room? or the door of the room will seal permanently before they escape, and we lost them in this game room.

To escape from this room, they need to solve a minimum number of puzzles within the given time limit for each round of the game. Only their problem-solving abilities, cunning, and cooperation will guide them through this perilous journey.


  • The first line contains an integer R (1 ≤ R ≤ 100), the number of rounds.

  • For each round, the input consists of:

    • Three integers N, M, and Mi (1 ≤ N, M, Mi ≤ 100), where N is the number of puzzles, M is the number of minutes before the door seals permanently, and Mi is the minimum number of puzzles they need to solve.
  • The next N lines contain the difficulty levels (in Munities) of the puzzle problems. Each line contains a single integer, representing the difficulty level Di (1 ≤ Di ≤ 100).


  • For each round, output "ESCAPE THE ROOM!" if Alim, Shanto, and Khalid can solve enough puzzles to escape the Room before it seals permanently. Otherwise, output "OPPS!".


5 15 3
4 10 3


  • In the first round, Alim, Shanto, and Khalid can solve problems 1, 2, and 4, requiring 5 + 3 + 4 = 12 minutes, allowing them to escape before the door seals permanently.

  • In the second round, Alim, Shanto, and Khalid can solve problems 1, 2, and 3, requiring 6 + 5 + 7 = 18 minutes; they are not able to escape before the door seals permanently.


Login to submit.


92% Solution Ratio
TanbirTopEarliest, 2M ago
Jaman_khanFastest, 0.0s
Nayma16Lightest, 5.2 MB
Tahmidul.4404Shortest, 414B
Toph uses cookies. By continuing you agree to our Cookie Policy.