CCC '01 S3 - Strategic Bombing

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2001 Stage 1, Junior #5, Senior #3

The Enemy relies heavily on the transportation of supplies and personnel between the specific points A and B. Points A and B, as well as other points C, D, E, etc. are linked by a network of roads. Your mission, should you accept it, is to identify a single road that may be bombed in order to cut off all traffic between A and B.

In the input, each point is identified by a single upper-case letter (there is a maximum of 26). Each line of input identifies a pair of points connected by a road. The end of input is indicated by a line containing **. All roads are two-way, that is, road AC is the same as road CA. There is at most one road between any pair of points.

Your output should identify all roads such that bombing any one of them would halt all traffic between A and B. Your output should list the roads, one per line, followed by a line stating that There are n disconnecting roads., where n is the number of such roads. If there is no such road, output There are 0 disconnecting roads..

Sample Input

AC
AD
AE
CE
CF
ED
GF
BG
HB
GH
**

Sample Output

CF
GF
There are 2 disconnecting roads.

Comments


  • 0
    Emera1d  commented on Feb. 29, 2024, 3:17 a.m.

    wow even the voting statistics represent what once was


  • 28
    luke3359767  commented on Aug. 19, 2020, 8:48 p.m.

    I got all AC although my code has problems


  • 3
    devnarula  commented on June 27, 2020, 3:15 a.m. edit 2

    Can anyone tell whats the issue with my code? I am getting WA on test case #2 and test case #5.

    (Edit: Nvm I figured it out, it was an issue with my loop and repetition)


  • 8
    d3story  commented on June 5, 2020, 11:57 p.m.

    I forgot one period lmao...


  • 41
    milan3sa  commented on May 31, 2020, 6:42 p.m.

    I love it how this was a 2001 problem


  • 41
    Aaeria  commented on Oct. 20, 2019, 6:46 p.m.

    The last sentence must end with a new line. Otherwise, you will get WA and not presentation error.


  • 7
    31501357  commented on March 20, 2019, 3:06 p.m.

    If I print FC instead of CF. Would that still be correct?


    • 10
      p1geon  commented on March 20, 2019, 5:52 p.m.

      road AC is the same as road CA.


      • 104
        Rimuru  commented on March 22, 2019, 1:19 p.m.

        But the road to AC involves WA, TLE, IR, MLE, and last but not least, IE!


        • 23
          p1geon  commented on March 22, 2019, 1:43 p.m.

          I'm in the same room as you.


  • 6
    MasterIlluminati  commented on Aug. 2, 2018, 10:02 p.m.

    What are the limits on the lines of input?


    • 3
      Fire_Fox  commented on Jan. 8, 2022, 5:05 p.m.

      179