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

12078번 - gCampus (Small) 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB44211947.500%

문제

Company G has a main campus with N offices (numbered from 0 to N - 1) and Mbidirectional roads (numbered from 0 to M - 1). The ith road connects a pair of offices (Ui, Vi), and it takes Ci minutes to travel on it (in either direction).

A path between two offices X and Y is a series of one or more roads that starts at X and ends at Y. The time taken to travel a path is the sum of the times needed to travel each of the roads that make up the path. (It's guaranteed that there is at least one path connecting any two offices.)

Company G specializes in efficient transport solutions, but the CEO has just realized that, embarrassingly enough, its own road network may be suboptimal! She wants to know which roads in the campus are inefficient. A road is inefficient if and only if it is not included in any shortest paths between any offices.

Given the graph of offices and roads, can you help the CEO find all of the inefficient roads?

입력

The first line of the input gives the number of test cases, T. T test cases follow. Each case begins with one line with two integers N and M, indicating the number of offices and roads. This is followed by M lines containing three integers each: Ui, Vi and Ci, indicating the ith road is between office Ui and office Vi, and it takes Ci minutes to travel on it.

Limits

  • 0 < Ci ≤ 1000000.
  • 1 ≤ T ≤ 10.
  • 1 ≤ N = M ≤ 100.

출력

For each test case, output one line containing "Case #x:", where x is the test case number (starting from 1). Then output the road numbers of all of the inefficient roads, in increasing order, each on its own line. (Note that road 0 refers to the first road listed in a test case, road 1 refers to the second road, etc.)

제한

예제 입력 1

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

예제 출력 1

Case #1:
0
Case #2:

힌트

출처

Contest > Google > Google's Coding Competitions > Google APAC 2016 University Graduates Test > Round A APAC Test 2016 C1번

Contest > Google > Kick Start > Google Kick Start 2015 > Round A C1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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