From cdf8358f3c6bb81d8b8cd2e1da91b6856f2dcfe4 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sat, 12 Oct 2024 15:00:59 +0800 Subject: [PATCH] update --- src/P1330/P1330.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/src/P1330/P1330.cpp b/src/P1330/P1330.cpp index 294989d..a27d4bf 100644 --- a/src/P1330/P1330.cpp +++ b/src/P1330/P1330.cpp @@ -1,3 +1,65 @@ +#include +#include +#include +#include + +using ll = long long; +using std::endl; +static auto &is = std::cin; +static auto &os = std::cout; + +static const ll max_n = 1e4+5; + +static ll n, m, a, b; +static std::vector next[max_n]; +static bool vis[max_n]; +static std::queue q; +static int colors[max_n]; +static ll color_sum[3]; +void set_color(const ll n,const int color)noexcept{ + colors[n]=color; + color_sum[color]++; +} + +void flush_exit()noexcept{ + os<>n>>m; + for(ll i{0};i>a>>b; + next[a].push_back(b); + next[b].push_back(a); + } + + bfs(); + os<