CCC '01 S3 - Strategic Bombing

View as PDF

Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 16M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
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


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

    I got all AC although my code has problems


  • 0
    devnarula  commented on June 26, 2020, 11:15 p.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)


  • 1
    d3story  commented on June 5, 2020, 7:57 p.m.

    I forgot one period lmao...


  • 11
    milan3sa  commented on May 31, 2020, 2:42 p.m.

    I love it how this was a 2001 problem


  • 18
    Aaeria  commented on Oct. 20, 2019, 2:46 p.m.

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


  • 1
    31501357  commented on March 20, 2019, 11:06 a.m.

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


    • 2
      p1geon  commented on March 20, 2019, 1:52 p.m.

      road AC is the same as road CA.


      • 27
        Rimuru  commented on March 22, 2019, 9:19 a.m.

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


        • 5
          p1geon  commented on March 22, 2019, 9:43 a.m.

          I'm in the same room as you.


  • 6
    SananR  commented on Oct. 3, 2018, 4:21 p.m.

    Keep getting test case #2 and #5 wrong, help please


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

    What are the limits on the lines of input?


  • 7
    isoffline  commented on Dec. 21, 2017, 12:08 p.m.

    No judge is available for this problem. When will it be fixed?


    • 13
      Kirito  commented on Dec. 21, 2017, 3:12 p.m.

      Issue is resolved.


      • -10
        Dordor1218  commented on March 23, 2018, 5:58 p.m. edited

        This comment is hidden due to too much negative feedback. Click here to view it.


  • 14
    Kirito  commented on Oct. 2, 2016, 10:20 p.m. edit 2

    Checker has been fixed, and solutions have been rejudged.


    • -1
      Chensta  commented on Dec. 21, 2017, 10:13 p.m.

      Why is Kirito being downvoted? Mistakes happen