update for ural ural1379.cpp,use bfs with some optimal