From f727064dc638c400714b93d792b1c46464fc4fc6 Mon Sep 17 00:00:00 2001 From: hanyixuanten Date: Tue, 27 Oct 2026 10:02:40 +0000 Subject: [PATCH] new file: solutions/P2607.md --- solutions/P2607.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 solutions/P2607.md diff --git a/solutions/P2607.md b/solutions/P2607.md new file mode 100644 index 0000000..1b7c758 --- /dev/null +++ b/solutions/P2607.md @@ -0,0 +1,11 @@ +# P2607 [ZJOI2008] 骑士 题解 + +先看[P1453](./P1453.md) + +只需要将仇恨关系视作一个连边即可。 + +本题与[P1453](../P1453.md)的区别是形成的不只是一个树+断边,而是一个森林+断边。 + +只需要将 [P1453 的并查集](../P1453.cpp#L35-42)改为[保存 $S, T$ vector](../P2607.cpp#L33-40),随后对于每个树+断边仿照 P1453 的实现即可 + +[code](../P2607.cpp)