天天看点

ACdream 1415 Important Roads

special judgetime limit: 20000/10000ms (java/others)memory limit: 128000/64000kb (java/others)

      the city where georgie lives has n junctions some of which are connected by bidirectional roads.

      every day georgie drives from his home to work and back. but the roads in the city where georgie lives are very bad, so they are very often closed for repair. georgie noticed that when some roads are closed he still can get from home to work in the same time as if all roads were available.

      but there are such roads that if they are closed for repair the time georgie needs to get from home to work increases, and sometimes georgie even cannot get to work by a car any more. georgie calls such roads important.

      help georgie to find all important roads in the city.

      the first line of the input file contains n and m — the number of junctions and roads in the city where georgie lives, respectively (2 ≤ n ≤ 20 000, 1 ≤ m ≤ 100 000). georgie lives at the junction 1 and works at the junction n.

      the following m lines contain information about roads. each road is specified by the junctions it connects and the time georgie needs to drive along it. the time to drive along the road is positive and doesn’t exceed 100 000. there can be several roads between a pair of junctions, but no road connects a junction to itself. it is guaranteed that if all roads are available, georgie can get from home to work.

      output l — the number of important roads — at the first line of the output file. the second line must contain l numbers, the numbers of important roads. roads are numbered from 1 to m as they are given in the input file.

andrew stankevich contest 22

mathlover

解题:我觉得最有意思的是求割边,带有重边的求割边。。。

ACdream 1415 Important Roads
ACdream 1415 Important Roads

view code

夜空中最亮的星,照亮我前行