Messager Problem(NOIOPJENGLISH20)

2022/2/8 6:14:01

本文主要是介绍Messager Problem(NOIOPJENGLISH20),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Messager Problem

https://acs.jxnu.edu.cn/problem/NOIOPJENGLISH20

 1000ms  65536K

描述:

There are N nodes in the graph. Given the length of edges between the nodes, find the shortest path of size N and the nodes in the path are all different.

图上有n个节点,给出每个节点间的长度,找到最小为n的路径并且每个节点的路径都是不同的

输入:

First line: one positive integer N (N <= 15).
Next N lines: the i-th line contains N non-negative integers (<= 1000) indicating the length of edges between the i-th node and other nodes.

第一行:一个正整数表示n

接下来n行:第i行包含n个非负整数表示第i个节点到其他点的距离

输出:

One line contains N integers, indicating the indexes of nodes in the shortest path.

一行包括n个整数,表示在最短路径中节点的序号

样例输入:

4
0 2 8 4
2 0 5 7
8 5 0 1
4 7 1 0

样例输出:

3 4 1 2


这篇关于Messager Problem(NOIOPJENGLISH20)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程