optimize the code
fix the bug of queries' reading
fix 2 bugs:
1. query reading;
2. floyd-warshall algorithm