编程介的小学生 2017-09-29 08:14 采纳率: 20.5%
浏览 966
已采纳

Brilliant Programmers Show

Problem Description
  Hunan TV holds many talent shows every year, such as Happy Girls and Super Boys which attract the attention of the whole country. This year Hunan University held a new type of talent show called Brilliant Programmers. Millions of programmers had registered online and only top N most brilliant programmers got the opportunity to compete on site. The organizer had hold ten rounds of qualification contest and programmers were ranked by their total scores. The programmers who ranked after N were eliminated.
  The final show continued for a very long time. Initially programmers were ranked by their qualification scores. The rule was special: A challenge may be happen between exactly two adjacent ranked programmers at any time and the lower ranked one tries to solve the other’s problem. If the challenger successfully solves this problem, their ranks exchange. Otherwise their ranks remain unchanged. It is guaranteed that a programmer never involved in two challenges at the same time. The top ranked programmer at last is the champion.
  The show was over but… The hard disk which logs the whole progress was burned out. After data rescue, the number of successful challenges of each programmer was recovered but the final rank was disappeared forever. During the rescue some errors may occur, which lead to some wrong recovered numbers. Is the show possible at all? If it is possible, can you help to find the champion from the very limited information?

Input
  There are multiple test cases.
  Each test case is described in two lines. The first line contains one integer N: the number of programmers. The second line contains a sequence of integers Ai that gives the number of successful challenges of the programmer initially ranked i-th.
1 <= N <= 106, 0 <= Ai <= 109
  The input will finish with the end of file.

Output
  For each case the output contains only one line.
  If it is an impossible show, output “Bad Rescue”. Otherwise if the champion is uniquely determined, output the initial rank of the champion. Output “Unknown” if the champion is not sure.

Sample Input
2
0 1
3
0 1 5
3
0 1 1

Sample Output
2
Bad Rescue
Unknown

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-17 00:41
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 python天天向上类似问题,但没有清零
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)