#10

small passed, large exceed
make visited and backtrace as vector, the most of the time is spend on building the graph with N^2