摘要: 拿起题就开始写,最后提交测试点2和测试点3就是过不去。 感觉一点问题都没有,好郁闷,找了半天,发现地点的编号是0开始的,而我一直在从1遍历.... 思路就是两个dijkstra,这两次思路是完全一样的,只是一个是最短距离最少节点,一个是最短时间最短距离,所以分别需要增加一个累计经过节点数量和累计节点 阅读全文
posted @ 2024-04-03 17:44 YuKiCheng 阅读(35) 评论(0) 推荐(0)
摘要: dijkstra。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int distances[1010][1010]; int dis[1020],visited[1020]; int edges[ 阅读全文
posted @ 2024-04-03 12:16 YuKiCheng 阅读(18) 评论(0) 推荐(0)
摘要: 首先,这是一个三维空间上的,题目的意思就是给了五个3*4的切片,从下往上叠在一起,对于一个像素点来说,他的前后左右上下这六个方向都是他的连通像素点。 代码: #include <bits/stdc++.h> using namespace std; int a[65][130][1300]; int 阅读全文
posted @ 2024-04-03 10:41 YuKiCheng 阅读(16) 评论(0) 推荐(0)
摘要: 并查集的应用,我感觉这题不是很容易想出来。然后....代码看注释吧。 写法一, #include <bits/stdc++.h> using namespace std; int a[1010][1010],fa[1010]; int getf(int x){ while(fa[x]!=-1){ x 阅读全文
posted @ 2024-04-03 08:54 YuKiCheng 阅读(20) 评论(0) 推荐(0)