Submit | All submissions | Best solutions | Back to list |
EIUEAGRP - Easy Graph |
Given an undirected graph which contains n vertices and m edges. Find the adjencent matrix for the given graph.
Input
The first line contains two integers n and m ( 1 ≤ n ≤ 1000, 0 ≤ m ≤ min(105, n*(n-1)/2) )
Each line in the next m lines contains three integers u, v and w (the edge between the two vertices u and v is weighted w). (1 ≤ u, v, w ≤ n ). It is sure that there is at most one edge between any two vertices.
Output
The required matrix
Example
Input: 3 2 1 2 2 2 3 3
Output: 0 2 0 2 0 3 0 3 0
Added by: | Ha Minh Ngoc |
Date: | 2015-12-23 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |