Topic link
Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=105&page=show_ problem&problem=1498
Topic Type: Search
Topic:
The prototypical computer adventure game, the designed in the Crowther as a PDP-10 at Computer-refereed Fantasy Gaming, and expanded into a puzzle-oriented game by Don Woods at Stanford in 1976. (Woods had been one of the authors of Intercal.) Now better known as Adventure or colossal Cave Adventure, but the TOPS-10 operating system permitted only Six-letter Ames in uppercase. Also Vadding, Zork, and Infocom.
It has recently been discovered to run Open-source software on the Y-crate gaming. A number of enterprising designers have developed advent-style games for deployment on the y-crate. Your job is to test a number of this designs to which are winnable.
Each game consists of a set of the up to rooms. One of the rooms is the "start and one of the" rooms is thefinish. Each room has a energy value between-100 and +100. One-way doorways interconnect pairs of rooms.
The player begins in the "Start room" with points. She through any doorway that connects the room she-to another room, thus entering the other room. The energy value of this room are added to the player ' s energy. This process continues until she wins by entering the finish room or dies by running out of energy (or quits in Frustratio n). During Her adventure The player may enter the same room several times, receiving their energy for each time.
The input consists of several test cases. Each test case begins with N, the number of rooms. The rooms are numbered from 1 (the "Start Room") to n (the finish room). Input for the n rooms follows. The input for each room consists of one or more lines containing:
The energy value for room I
The number of doorways leaving room I
A list of the rooms that are reachable by the doorways leaving room I
The start and finish rooms would always have enery level 0. A Line containing-1 follows the last test case.
In one for each case, output "winnable" if it is possible for the player to win, otherwise output "hopeless".
Title translation:
Background: A typical computer adventure game, first appeared in the mid-1970 PDP-10 computer (Digital equipment company Dec production), was designed by would Crowther. This is a fantasy game that tries to be judged by a computer. Don Woods of Stanford University in 1976 expanded it into a jigsaw puzzle (Don Woods is one of Intercal's authors). Now more famous is the adventure or the huge cave adventure game. However, the PDP-10 operating system allows only 6 uppercase-letter file names. For more information, please inquire vadding, Zork, and Infocom. Recently, people have found out how to run open source software on y-crate gaming devices. Many corporate designers have deployed to develop good advent-style style games on y-crate. Your job is to test whether these designs are likely to win. Each game consists of a group of 100 rooms. One of the rooms is the starting point and the other room is the end. Each room has an energy value, from 100 to + 100. Some of them can only walk through the door to connect these rooms together. The player will automatically get 100 points of energy at the beginning. She can enter another door through a one-way room door, and can enter a room at any number of repetitions, and every time you enter that room, you can get that energy value (the positive energy value is to increase her energy and negative values to reduce her energy). If you can get to the finishing room before the energy is run out (into 0 or minus), you can win. Otherwise, it is lost.
Sample input:
5
0 1 2
-60 1
3 -60 1 4
a 1 5 0 0 5 0 1 2 a 1 3 -60 1 4 -60 1 5 0 0 5
0 1 2, 1 3 -60 1 4, -60 1 5 0 0 5 0 1 2 2 1 3 -60 1 4 -60 1-
5
0 0
-1
Sample output:
Hopeless
hopeless
winnable
winnable