Description It is year 2500 A.D. and there is a terrible war between the forces of the Earth and the Mars. Recently, the commanders of the Earth are informed by their spies that the invaders of Mars want to land some paratroopers in them× n grid yard…
How far away [题目链接]How far away [题目类型]dfs+邻接表 &题意: 题目大意:一个村子里有n个房子,这n个房子用n-1条路连接起来,接下了有m次询问,每次询问两个房子a,b之间的距离是多少. &题解: 我以为是LCA的题,但dfs居然也能过,感觉是数据有点弱,(时间复杂度是4000x200x10,想了想10组又不能全是200,所以应该勉强可以)但学到了邻接表的数组形式,用数组表示链表,很厉害的样子,感觉和前向星好相似啊 &代码: #include…