Logo
(追記) (追記ここまで)

3515번 - Immediate Delivery 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB60151530.612%

문제

Mike and John are delivery boys of Immediate Delivery. One day they were asked to deliver a lot of packages all over the city.

The transport system of the city they work in consists of junctions and roads connecting these junctions. All roads are bidirectional and all junctions are accessible from each other (directly or indirectly).

Mike and John should visit all the junctions to deliver all packages. They want to split this task into two parts in a way that minimizes the time of the last delivery.

입력

The first line contains two integer numbers n and m, the number of junctions and roads (1 ≤ n ≤ 18).

The following m lines describe roads. Each line contains three integer numbers: xi and yi (1 ≤ xi, yi ≤ n), the numbers of junctions connected with this road and ti (1 ≤ ti ≤ 1000), the time required to drive it. There is at most one road connecting any two junctions. No road connects a junction to itself.

The office of the Immediate Delivery is placed at the junction number 1.

출력

The first line of the output file must contain the minimal possible time when the last package can be delivered.

The second line must contain the route for Mike: the number of roads p, traveled by Mike and p + 1 numbers of junctions he visited in order they were visited, starting with junction number 1.

The third line must contain the route for John in the same format.

제한

예제 입력 1

6 6
1 2 10
2 3 10
3 4 5
4 5 10
5 6 20
2 5 10

예제 출력 1

40
3 1 2 5 6
4 1 2 3 4 5

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > NEERC Northern Subregional 2011 I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /