Коль Дейкстрý писать без кучи,
То тайм-лимит ты получишь...
А в совсем другой задаче
Юзай кучу Фибоначчи!
___________________________________________
Спектакль преподавателей ЛКШ.июль-2007
Undirected weighted graph is given. Find the weight of the minimal path between two vertices.
The first line contains two numbers and — the number of vertices and edges. Second line contains two numbers and — the numbers of the vertices the length between which you need to find.
The next lines contain the description of the edges, one edge in a line. The edge number is described with three integers и — the vertices connected by the edge and its weight.
Print the weight of the minimal path between the vertices and , or if there is no such path.