간단한 최단 경로를 찾는 문제
Time Limit: 1 SecMemory Limit: 256 MiB
Example Input 1
4 4
1 2 3
2 3 5
2 4 2
3 4 1
1 4
Example Output 1
5
Example Input 2
5 7
1 2 8
1 4 2
2 3 12
2 5 5
3 5 3
4 3 4
4 5 17
1 5
Example Output 2
13
Example Input 3
4 2
1 2 3
3 4 5
3 2
Example Output 3
-1
Example Input 4
4 4
1 2 3
2 3 5
2 4 2
3 4 1
4 1
Example Output 4
-1
Language-Specific Restrictions
© 2023-2025. All rights reserved.
Powered by @Rn
logo