{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"Description 题目描述","value":{"format":"HTML","content":" It has recently been discovered how to run open-source software on the Y-Crate gaming device. A number of enterprising designers have developed Advent-style games for deployment on the Y-Crate. Your job is to test a number of these designs to see which are winnable. \n \u003cbr\u003eEach game consists of a set of up to 100 rooms. One of the rooms is the start and one of the rooms is the finish. Each room has an energy value between -100 and +100. One-way doorways interconnect pairs of rooms. \n \u003cbr\u003e \n \u003cbr\u003eThe player begins in the start room with 100 energy points. She may pass through any doorway that connects the room she is in to another room, thus entering the other room. The energy value of this room is added to the player\u0027s energy. This process continues until she wins by entering the finish room or dies by running out of energy (or quits in frustration). During her adventure the player may enter the same room several times, receiving its energy each time. \n \u003cbr\u003e \n \u003cbr\u003e\n最近,有人发现了如何在Y-Crate游戏设备上运行开源软件。许多有进取心的设计师开发了Advent风格的游戏,可以在Y-Crate上进行部署。你的工作是测试一些设计,看看哪些是可赢的。\n \u003cbr\u003e\n每场比赛由多达100个房间组成。其中一个房间是起点,其中一个房间是终点。每个房间的能量值介于-100和+100之间。对于这些房间,两两之间有单向门连接。\n \u003cbr\u003e\n \u003cbr\u003e\n玩家在起点时有100点能量。她可以通过任何连接她所在房间的单向门到另一个房间。这个房间的能量值会增加到玩家的能量储蓄。这个过程将一直持续到她进入终点获胜或因能量耗尽而死亡(或者沮丧地退出)。在她的冒险中,玩家可以多次进入同一个房间,每次都能获得房间所提供的能量。\n\u003cbr\u003e\n"}},{"title":"Input 输入","value":{"format":"HTML","content":"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: \n\u003cbr\u003e \n\u003cbr\u003ethe energy value for room i \n\u003cbr\u003ethe number of doorways leaving room i \n\u003cbr\u003ea list of the rooms that are reachable by the doorways leaving room i \n\u003cbr\u003eThe start and finish rooms will always have enery level 0. A line containing -1 follows the last test case. \n\u003cbr\u003e\n\u003cbr\u003e\n输入包含多组数据。每组数据都以房间数n开始。房间的编号顺序是从1(起点)到n(终点)。接下来是有关n个房间的信息。每个房间的输入包含一行或多行,包含:\n\u003cbr\u003e\n\u003cbr\u003e\n·房间i的能量值\n\u003cbr\u003e\n·离开房间i的单向门数量\n\u003cbr\u003e\n·离开房间i的单向门可以到达的房间列表\n\u003cbr\u003e\n\u003cbr\u003e\n注:起点和终点房间的能量值均为0。当输入-1时,表明输入结束。\n\n"}},{"title":"Output 输出","value":{"format":"HTML","content":"In one line for each case, output \"winnable\" if it is possible for the player to win, otherwise output \"hopeless\". \n\u003cbr\u003e\n\u003cbr\u003e\n在每组数据对应的一行输出中,如果玩家有可能获胜,则输出“winnable”,否则输出“hopeless”。"}},{"title":"Sample Input 样例输入","value":{"format":"HTML","content":"\u003cpre\u003e5\n0 1 2\n-60 1 3\n-60 1 4\n20 1 5\n0 0\n5\n0 1 2\n20 1 3\n-60 1 4\n-60 1 5\n0 0\n5\n0 1 2\n21 1 3\n-60 1 4\n-60 1 5\n0 0\n5\n0 1 2\n20 2 1 3\n-60 1 4\n-60 1 5\n0 0\n-1\u003c/pre\u003e"}},{"title":"Sample Output 样例输出","value":{"format":"HTML","content":"\u003cpre\u003ehopeless\nhopeless\nwinnable\nwinnable\u003c/pre\u003e"}}]}