01:59(160)

This commit is contained in:
Your Name committed 2026-11-01 01:59:35 +08:00
1 parent 9362c48811
commit bbc2a605d4
3 files changed
+133 -5

No files matched your search

+4 -1
View File
@@ -55,7 +55,8 @@ int main() {
}
}
// dig(x);
printf("%lld\n", 1ll * w[x] + 1ll * w[y] + ans);
if(ans == LLONG_MAX) printf("-1\n"); // 疑似算法有问题
else printf("%lld\n", 1ll * w[x] + 1ll * w[y] + ans);
}
return 0;
}
@@ -66,4 +67,6 @@ g++ subway/subway.cpp -o subway/subway -std=c++14 -O2 -static -Wall && cp subway
500 条线路各视为图上的一个点,分别和地铁站连线
考虑优化,注意到可以预处理维护两个地铁线路的最短距离,再枚举起点终点的线路选择
爆longlong得到负值(原因为数据构造器未保证连通)
*/