# D - Make Bipartite 2(400) ###### tags: `Atocder` ## Question [D - Make Bipartite 2](https://atcoder.jp/contests/abc282/tasks/abc282_d) ## Solution 1. 先確認當前的 graph 是否為 bipartite graph. (使用bfs or dfs) 2. 在每個 graph 內,確認好所有點的 party 後,計算當前 graph 內的組數。 3. 不同的 graph,彼此任意的點互聯,仍然是 bipartite graph,因此紀錄跟當前 graph 不同 graph 的點的數量,然後相乘。 4. 將所有 graph 內與外的組數總和相加。 ## Code [bfs](https://atcoder.jp/contests/abc282/submissions/38012421)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up