diff --git a/src/P1330/P1330.cpp b/src/P1330/P1330.cpp index a70c240..9325224 100644 --- a/src/P1330/P1330.cpp +++ b/src/P1330/P1330.cpp @@ -1,9 +1,6 @@ //#define NDEBUG #include -#include #include -#include -#include #include #include #define NV(v)#v<<" : "<<(v) @@ -14,74 +11,62 @@ #endif using ll = long long; -static const ll max_n = 1e4+5; +using std::endl; static auto &is = std::cin; static auto &os = std::cout; -static ll n,m,u,v; -std::vector map[max_n]; -std::bitset vis; -std::array colors; -struct Status{ - ll now; - int color; -}; -std::queue q; -ll color_sum[3]; +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"; - ) - if(vis[next_status.now]){ - DEBUG( - os<>n>>m; + + for(ll i{0};i>u>>v; + map[u].push_back(v); + map[v].push_back(u); + } + + bfs(); + + os<