import java.util.*;
class Node {
private int index;
private int distance;
public Node(int index, int distance) {
this.index = index;
this.distance = distance;
}
public void show() {
System.out.print("(" + this.index + "," + this.distance + ") ");
}
}
public class Main {
// í(Row)ì´ 3ê°ì¸ ì¸ì 리ì¤í¸ íí
public static ArrayList> graph = new ArrayList>();
public static void main(String[] args) {
// ê·¸ëí ì´ê¸°í
for (int i = 0; i < 3; i++) {
graph.add(new ArrayList());
}
// ë
¸ë 0ì ì°ê²°ë ë
¸ë ì ë³´ ì ì¥ (ë
¸ë, 거리)
graph.get(0).add(new Node(1, 7));
graph.get(0).add(new Node(2, 5));
// ë
¸ë 1ì ì°ê²°ë ë
¸ë ì ë³´ ì ì¥ (ë
¸ë, 거리)
graph.get(1).add(new Node(0, 7));
// ë
¸ë 2ì ì°ê²°ë ë
¸ë ì ë³´ ì ì¥ (ë
¸ë, 거리)
graph.get(2).add(new Node(0, 5));
// ê·¸ëí ì¶ë ¥
for (int i = 0; i < 3; i++) {
for (int j = 0; j < graph.get(i).size(); j++) {
graph.get(i).get(j).show();
}
System.out.println();
}
}
}