传送门

题面:

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-31−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−1 .

That is, if there are three options in a selection, the score will be increased by 11, decreased by 11, or multiplied by -1−1. The score before the selection is 88. Then selecting option 11 will make the score become 99, and selecting option 22 will make the score 77 and select option 33 to make the score -8−8. Note that the score has an upper limit of 100100 and a lower limit of -100−100. If the score is 9999 at this time, an option that makes the score +2+2 is selected. After that, the score will change to 100100 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 kk, it will enter a good ending; if it is less than or equal to a certain value ll, 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 kk, ll 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 kk value, the ll 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,ln,m,k,l(1\le n \le 10001≤n≤1000, -100 \le m \le 100−100≤m≤100 , -100 \le l < k \le 100−100≤l<k≤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 nn lines contains three integers a,b,ca,b,c(a\ge 0a≥0 , b\ge0b≥0 ,c=0c=0 or c=1c=1),indicates the options that appear in this selection,in which a=0a=0 means there is no option to increase the score in this selection, a>0a>0 means there is an option in this selection to increase the score by aa ; b=0b=0 means there is no option to decrease the score in this selection, b>0b>0 means there is an option in this selection to decrease the score by bb; c=0c=0 means there is no option to multiply the score by -1−1 in this selection , c=1c=1 means there is exactly an option in this selection to multiply the score by -1−1. It is guaranteed that a,b,ca,b,c are not equal to 00 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 徐州赛区网络预赛

题意:

有两个人在玩游戏,他们最开始有积分m分,如果最终的积分val>=k,则进入Bad Ending,如果最终积分val<l 则进入Good Ending。现在一共有n个关卡,每个选项有三个选项a,b,c,a代表使得积分+a,b代表使得积分+b,c==1代表使得积分*-1。如果a或b等于0,则不能选择,题目保证a,b,c不同时为0,A先选,B后选,A想要进入GE,B想要进入BE,他们都会进行最优的操作,问你最后的结局。

分析:一开始就往博弈的方面去考虑的,披着博弈的DP , 没有想到这就是简单的DP转移,a想得到自己想要的结局肯定是越大越好拉 , b想赢肯定是越小越好了,依据这个理论概念,可以dp枚举,怎么DP呢? 设DP(i,j)表示第i个现在分数是J的最小或者最大分数 , 注意范围是-100,100 , 可以偏移也可以用map, 我这是用了map , 防止变量搞错了 ;

!!!!!(这题也可以博弈的做法,挡分析挺复杂的,留着以后)

#include<bits/stdc++.h>

using namespace std ;

const int maxn = ;
map<int , map<int,int> > dp ; int a[maxn],b[maxn],c[maxn];
int main( )
{
int n , m , k , l;
scanf("%d%d%d%d" , &n , &m , &k , &l);
for(int i = ; i<=n ; i++)
scanf("%d%d%d",&a[i],&b[i],&c[i]);
for(int i=- ; i<= ; i++)
dp[n+][i] = i;
for(int i=n ; i>= ; i--)
{
for(int j=- ; j<= ; j++)
{
if(i%==)
{ dp[i][j]=;
if(a[i])
dp[i][j]=min(dp[i][j],dp[i+][min(j+a[i],)]);
if(b[i])
dp[i][j]=min(dp[i][j],dp[i+][max(j-b[i],-)]);
if(c[i])
dp[i][j]=min(dp[i][j],dp[i+][-j]);
}
else{
dp[i][j]=-;
if(a[i])
dp[i][j]=max(dp[i][j],dp[i+][min(j+a[i],)]);
if(b[i])
dp[i][j]=max(dp[i][j],dp[i+][max(j-b[i],-)]);
if(c[i])
dp[i][j]=max(dp[i][j],dp[i+][-j]);
}
}
}
if(dp[][m]>=k)
puts("Good Ending");
else if(dp[][m]<=l)
puts("Bad Ending");
else
puts("Normal Ending");
}

总结:以后考虑题的时候,需要多方面的考虑 , 考虑多方法

ACM-ICPC 2018 徐州赛区网络预赛 B(dp || 博弈(未完成)的更多相关文章

  1. ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心)

    ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in t ...

  2. ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer (最大生成树+LCA求节点距离)

    ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer ...

  3. 计蒜客 1460.Ryuji doesn't want to study-树状数组 or 线段树 (ACM-ICPC 2018 徐州赛区网络预赛 H)

    H.Ryuji doesn't want to study 27.34% 1000ms 262144K   Ryuji is not a good student, and he doesn't wa ...

  4. ACM-ICPC 2018 徐州赛区网络预赛 B. BE, GE or NE

    In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...

  5. ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn't want to study

    262144K   Ryuji is not a good student, and he doesn't want to study. But there are n books he should ...

  6. ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track

    262144K   Morgana is learning computer vision, and he likes cats, too. One day he wants to find the ...

  7. ACM-ICPC 2018 徐州赛区网络预赛 I. Characters with Hash

    Mur loves hash algorithm, and he sometimes encrypt another one's name, and call him with that encryp ...

  8. ACM-ICPC 2018 徐州赛区网络预赛 D 杜教筛 前缀和

    链接 https://nanti.jisuanke.com/t/31456 参考题解  https://blog.csdn.net/ftx456789/article/details/82590044 ...

  9. ACM-ICPC 2018 徐州赛区网络预赛(8/11)

    ACM-ICPC 2018 徐州赛区网络预赛 A.Hard to prepare 枚举第一个选的,接下来的那个不能取前一个的取反 \(DP[i][0]\)表示选和第一个相同的 \(DP[i][1]\) ...

随机推荐

  1. HihoCoder1665方块游戏([Offer收割]编程练习赛40)(线段树)

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Ho在玩一款类似俄罗斯方块的游戏.与原版俄罗斯方块不同的是,落下方块都是长度不一的横向长条,并且不能移动也不能变成竖直方 ...

  2. 1143. Lowest Common Ancestor (30)

    The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U ...

  3. ASP里面令人震撼地自定义Debug类(VBScript)

    不知道用ASP写代码的朋友是不是和我有一样的感受,ASP中最头疼的就是调试程序的时候不方便 我想可能很多朋友都会用这样的方法“response.write ”,然后输出相关的语句来看看是否正确.前几天 ...

  4. node好用的东东

    supervisor 可参考: http://www.cnblogs.com/pigtail/archive/2013/01/08/2851056.html http://www.cnblogs.co ...

  5. 制作spark镜像

    构建镜像 添加jdk引用(可以使用yum进行安装): 安装SSH 碰到一个问题,执行systemctl的时候发生了异常: Failed to get D-Bus connection 解决这个问题的方 ...

  6. 自定义type为file型input控件+该控件具有本地图片预览功能

    最近的一个项目需求是写一个type为filex型的input控件,这个控件: 第一,要自定义样式: 第二,要能直接在本地预览上传的图片: 第三,要能检测图片的尺寸是否符合要求. 故综合网上的资源写了下 ...

  7. Poj1062 昂贵的聘礼 (dijkstra算法)

    一.Description 年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女儿嫁给他.探险家拿不出这么多金币,便请求酋长 ...

  8. 问题11:如何进行反向迭代 & 如何实现反向迭代

    # 有关列表问题,参考:Python:列表list 案例: 需求:实现一个连续浮点数发生器FloatRange(和range类似),根据给定范围(start,end)和步进值(step),产生一系列连 ...

  9. RS-485收发的零延时转换电路

    转自:http://www.dzsc.com/data/html/2007-5-28/41097.html RS-485是一种基于差分信号传送的串行通信链路层协议.它解决了RS-232协议传输距离太近 ...

  10. [.net] 无法创建虚拟目录。已将URL“XXX”映射到IIS Express网站上的一个不同的文件夹

    工作时,在修改项目属性,Web中服务器时,出现了下面的错误: 各种折腾后,找到下面的解决方法: 1.找到项目在本地的目录,目录下有当前项目的项目文件,文件名以.csproj为后缀名. 2.用文本编辑软 ...