시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 20 | 10 | 10 | 50.000% |
Harry is a mathematician who likes to play with graphs. He has drawn a weighted undirected graph on the blackboard, and computed that the length of the shortest path between two nodes is s. Unfortunately he has to leave the room, therefore he quickly writes down s and the weights of all edges on a piece of paper, and he wipes the blackboard. Then it dawns on him: this information is not enough to reconstruct his beautiful graph!
Write a program that constructs some graph matching the information that Harry wrote down.
The input consists of:
Output a graph consisting of a number of 1-indexed nodes and exactly e edges, such that the edge lengths correspond to the lengths in the input, and the length of the shortest path between nodes 1 and 2 is s. The graph must be connected, must not contain self-loops and can have at most one edge between each pair of nodes. You may assume that such a graph exists.
The output must consist of:
If there are multiple correct answers, you may give any of them.
4 5 1 5 3 2 2
4 1 3 1 1 4 2 4 2 2 3 2 3 3 4 5
ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2016 PB번