• [F] Treasures

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Luke has a treasure map. The treasure map has N cities (Numbered 1 to N).

    These cities are connected with some paths. And there is a treasure in every city.

    So if Luke arrives a city, he can get the treasure in the city.


  • 输入
  • There are multiple test cases.
    Each case starts with three integers N ,M S (1<=N<=100000 ,0<=M<=150000), means the number of cities and the paths. S means the start city of Luke.
    And next are M pairs of integers Vi and Ui(1<=Vi,Ui<=N), means there is a path from Vi to Ui(one-way path).
  • 输出
  • For each test case, print a line “Case T:”,T starts with 1. The next line print the maximum of treasures.
  • 样例输入
  • 4 3 1
    1 2
    2 3
    2 4
    5 4 1
    1 2
    2 3
    2 4
    3 2
    
  • 样例输出
  • Case 1:
    3
    Case 2:
    4
    
  • 提示
  • 来源
  • hrbeu
  • 操作

显示春菜