• [1412] Poor Mr. Cai

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Mr. Cai decides to build two houses for TT - They're going to get married.

    But because the poverty, Mr. Cai can only buy a ground that full of puddles. The puddles are not full of water but some other things like sulfuric acid and so on.

    At night, Mr. Cai and TT can easily drop into a puddle because there're no lights. And they may drop into another one after they crawl out.

    You know, some chemicals will make a boom-boom-boom after mix. For example, when they dropped into a puddle that is full of ammonium nitrate after they crawl out of a puddle that is full of diesel fuel, there will be a "big bang"!

    You can assume that at night they may often drop into any two puddles in the same house.

    Every big bang will hurt them. To survive, Mr. Cai have to minimize the harm by letting the puddles be in the different houses.

    Mr. Cai and TT has their own defense value. If the harm of one big bang exceeds one's defense value, she/he will die. Can you tell me who can survive at last?

  • 输入
  • This problem contain several cases.
    The first line of each case are two integers N and M (There're N puddles numbered 1~N and M possibility will make a big bang, 2 < N < 20000, 1 < M < 100000).
    Next line contains two integers C and T, indicate the defense value of Mr. Cai and TT.
    Then M lines followed, each line contains three integers P1i, P2i and Hi (P1i and P2i indicate the numbers of two puddles, Hi indicates the harm of this big bang).
  • 输出
  • For each case, you should tell me who will survive.
    If only Mr. Cai can survive, output "TT Boom!".
    If only TT can survive, output "Mr. Cai Boom!".
    If both of them survive, output "Survive".
    Otherwise, output "Boom! boom!! boom!!!".
    And then output the biggest bang.
  • 样例输入
  • 4 6
    200 213
    1 4 123
    2 3 321
    1 2 213
    1 3 231
    2 4 132
    3 4 312
    
  • 样例输出
  • Mr. Cai Boom!
    213
  • 提示
  • 来源
  • XadillaX
  • 操作

显示春菜