problem 122,first submit, got "Memory Limit Exceeded on test 13, 62ms, 8647kb"
problem 122, second submit
change function from recursive to loop, got "Time Limit Exceeded on test 22 	750 ms	2707 kb"
problem 122, third submit, got "Time Limit Exceeded on test 22 	750 ms	2795 kb"

change use array visited to replace function is_ok, use space to save time.
is_ok is O(n) on time, after change it is constant
problem 122, forth submit, got "Time Limit Exceeded on test 22 	531 ms	2203 kb"

change function next, use array 'index' to record the next child which will be visited. use space to save time.
the time-consuming change to constant from O(n).