{"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":"","value":{"format":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n 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\u003c/div\u003e\n\u003cbr\u003e有一个游戏,在一些房间中进行。游戏者初始的时候在1号房间,有100点能量。\n\u003cbr\u003e接着通过一些有向边,到达其他房间。进入每个房间时会产生能量变化,增加一些能量或者减少一些能量(以后再进入这个房间,还是会发生变化)。\n\u003cbr\u003e能量小于等于0,就输了。\n\u003cbr\u003e最终到达n点,并且能量大于0,就算赢了。"}},{"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\u003d-1时结束\n\u003cbr\u003e接下来有n行,描述每个房间,不超过100。\n\u003cbr\u003e第一个整数,表示进入这个房间会获得能量(范围[-100,100])。接下来一个整数k,表示这个房间可以到达哪些房间,接下来k个整数,表示可以到达的房间。"}},{"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如果能获胜,输出“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"}}]}