22788_LastMinuteConstructions

2022-5-16 18:22| 发布者: Hocassian| 查看: 19| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506959099699-Problem List-采集的数据-后羿采集器.html

Pro.ID

22788

Title

Last Minute Constructions

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22788

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Forthe upcoming soccer world championship's finals in South Africa the organisation committee has planned a very prestigious project. To take the two teams, which are battling it out for the title, to new heights, the final should take place on a plateau of the "Mafadi", the highest mountain of South Africa. During the preparations, the logistics of such a huge event have been severely underestimated.

    Now,with barely a month to go, the stadium on top of the plateau is finished but the means of transportation to the plateau are next to nonexistent. Until now, there are only small roads connecting many little villages spread all over the mountain. Furthermore, known for their efficiency, ancient South African builders only built a road between two villages, if no other connection existed so far.

    Sincethe amount of fans would exceed the capacity of the small mountain roads, this leaves the committee with only one choice: improve the possibilities to reach the mountain at one of the sites. But as if this wasn't enough trouble to go through, the mountain folks have announced to sabotage the finals, if the constructions would disturb any village more than once. Since the committee has access to an old tunnel-drill, it has decided to create a number of alternative routes todivert a bit of the traffic.

    The engineers have identified a number of possible sites, all offering a good landing spot to fly in the giant drill to and a takeoff spot to transport the drill back from. But as the drill is really old, it has to follow the natural structures in the rock and can therefore only be used to drill in the given direction. Thus, the engineers seek your help to identify the sites on which a route for the drill (using existing roads and drilling new tunnels) exists from the landing platform to the takeoff spot, visiting each village at most once. Furthermore, a valid route needs to contain all the tunnels identified necessary by the engineers, and it should contain no other tunnels.

    输入

    Theinput to your program provided by the South African building committee will be structured as follows. Each input file begins with the number of test cases ona single line. On the first line of every test case three numbers N, M, T (1 ≤ N, M ≤ 100000,  0 ≤ T ≤ 100000) will specify the number of villages, as well as connections and tunnels to follow. The second line specifies the location of the landing platform and the takeoff spot respectively (landing platformtakeoff spot). After this M lines follow, each giving a pair of villages ab (0 ≤ a, b < N,  ab) to indicate an existing road between a and b which can be used in both directions. Finally T lines follow, each giving a pair of villages ab (0 ≤ a, b < N,  ab) to indicate that a tunnel was deemed necessary for the finals from a to b. The tunnel has to be drilled in the direction from a to b.

    输出

    Description

    Forthe upcoming soccer world championship's finals in South Africa the organisation committee has planned a very prestigious project. To take the two teams, which are battling it out for the title, to new heights, the final should take place on a plateau of the "Mafadi", the highest mountain of South Africa. During the preparations, the logistics of such a huge event have been severely underestimated.

    Now,with barely a month to go, the stadium on top of the plateau is finished but the means of transportation to the plateau are next to nonexistent. Until now, there are only small roads connecting many little villages spread all over the mountain. Furthermore, known for their efficiency, ancient South African builders only built a road between two villages, if no other connection existed so far.

    Sincethe amount of fans would exceed the capacity of the small mountain roads, this leaves the committee with only one choice: improve the possibilities to reach the mountain at one of the sites. But as if this wasn't enough trouble to go through, the mountain folks have announced to sabotage the finals, if the constructions would disturb any village more than once. Since the committee has access to an old tunnel-drill, it has decided to create a number of alternative routes todivert a bit of the traffic.

    The engineers have identified a number of possible sites, all offering a good landing spot to fly in the giant drill to and a takeoff spot to transport the drill back from. But as the drill is really old, it has to follow the natural structures in the rock and can therefore only be used to drill in the given direction. Thus, the engineers seek your help to identify the sites on which a route for the drill (using existing roads and drilling new tunnels) exists from the landing platform to the takeoff spot, visiting each village at most once. Furthermore, a valid route needs to contain all the tunnels identified necessary by the engineers, and it should contain no other tunnels.

    Input

    Theinput to your program provided by the South African building committee will be structured as follows. Each input file begins with the number of test cases ona single line. On the first line of every test case three numbers N, M, T (1 ≤ N, M ≤ 100000,  0 ≤ T ≤ 100000) will specify the number of villages, as well as connections and tunnels to follow. The second line specifies the location of the landing platform and the takeoff spot respectively (landing platformtakeoff spot). After this M lines follow, each giving a pair of villages ab (0 ≤ a, b < N,  ab) to indicate an existing road between a and b which can be used in both directions. Finally T lines follow, each giving a pair of villages ab (0 ≤ a, b < N,  ab) to indicate that a tunnel was deemed necessary for the finals from a to b. The tunnel has to be drilled in the direction from a to b.

    Output

    For each of the presented test cases, print a single line containing either "IMPOSSIBLE" whenever the construction is not possible, or "POSSIBLE" whenever the constructions can be carried out under the given restrictions.

    Sample Input

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

    Sample Output

    POSSIBLE
    IMPOSSIBLE

    Source

    样例输入

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

    样例输出

    POSSIBLE
    IMPOSSIBLE

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部