×

计蒜客

  1. 题库
  2. BE, GE or NE
  3. 问答
  • 25.18%
  • 1000ms
  • 262144K

In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of this video game is quite unique: in the process of playing this game, you need to constantly face the choice, each time you choose the game will provide $1-3$ options, the player can only choose one of them. Each option has an effect on a "score" parameter in the game. Some options will increase the score, some options will reduce the score, and some options will change the score to a value multiplied by $-1$ .

That is, if there are three options in a selection, the score will be increased by $1$, decreased by $1$, or multiplied by $-1$. The score before the selection is $8$. Then selecting option $1$ will make the score become $9$, and selecting option $2$ will make the score $7$ and select option $3$ to make the score $-8$. Note that the score has an upper limit of $100$ and a lower limit of $-100$. If the score is $99$ at this time, an option that makes the score $+2$ is selected. After that, the score will change to $100$ and vice versa .

After all the choices have been made, the score will affect the ending of the game. If the score is greater than or equal to a certain value $k$, it will enter a good ending; if it is less than or equal to a certain value $l$, it will enter the bad ending; if both conditions are not satisfied, it will enter the normal ending. Now, Koutarou and Sena want to play the good endings and the bad endings respectively. They refused to give up each other and finally decided to use the "one person to make a choice" way to play the game, Koutarou first choose. Now assume that they all know the initial score, the impact of each option, and the $k$, $l$ values, and decide to choose in the way that works best for them. (That is, they will try their best to play the ending they want. If it's impossible, they would rather normal ending than the ending their rival wants.)

Koutarou and Sena are playing very happy, but I believe you have seen through the final ending. Now give you the initial score, the $k$ value, the $l$ value, and the effect of each option on the score. Can you answer the final ending of the game?

Input

The first line contains four integers $n,m,k,l$($1\le n \le 1000$, $-100 \le m \le 100$ , $-100 \le l < k \le 100$ ), represents the number of choices, the initial score, the minimum score required to enter a good ending, and the highest score required to enter a bad ending, respectively.

Each of the next $n$ lines contains three integers $a,b,c$($a\ge 0$ , $b\ge0$ ,$c=0$ or $c=1$),indicates the options that appear in this selection,in which $a=0$ means there is no option to increase the score in this selection, $a>0$ means there is an option in this selection to increase the score by $a$ ; $b=0$ means there is no option to decrease the score in this selection, $b>0$ means there is an option in this selection to decrease the score by $b$; $c=0$ means there is no option to multiply the score by $-1$ in this selection , $c=1$ means there is exactly an option in this selection to multiply the score by $-1$. It is guaranteed that $a,b,c$ are not equal to $0$ at the same time.

Output

One line contains the final ending of the game. If it will enter a good ending,print "Good Ending"(without quotes); if it will enter a bad ending,print "Bad Ending"(without quotes);otherwise print "Normal Ending"(without quotes).

样例输入1

3 -8 5 -5
3 1 1
2 0 1
0 2 1

样例输出1

Good Ending

样例输入2

3 0 10 3
0 0 1
0 10 1
0 2 1

样例输出2

Bad Ending

题目来源

ACM-ICPC 2018 徐州赛区网络预赛

想挑战这道题吗

  • main.c