1775.
Senior Pan
时间限制 15000 ms
内存限制 128 MB
Senior Pan fails in his discrete math exam again. So he asks Master ZKC to give him graph theory problems everyday.
The task is simple : ZKC will give Pan a directed graph every time, and selects some nodes from that graph, you can calculate the minimum distance of every pair of nodes chosen in these nodes and now ZKC only cares about the minimum among them. That is still too hard for poor Pan, so he asks you for help.
输入数据
输出数据
For every Test Case, output one integer: the answer
样例输入
复制
1
5 6
1 2 1
2 3 3
3 1 3
2 5 1
2 4 2
4 3 1
3
1 3 5
\n
· \n
· · \n
· · \n
· · \n
· · \n
· · \n
· · \n
\n
· · \n