Codeforces Round #309 (Div. 1) C. Love Triangles(二分图)

There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which hasncharacters. The characters are labeled from1ton. Every pair of two characters can either mutually love each other or mutually hate each other (there is no neutral state).

You hate love triangles (A-B are in love and B-C are in love, but A-C hate each other), and you also hate it when nobody is in love. So, considering any three characters, you will be happy if exactly one pair is in love (A and B love each other, and C hates both A and B), or if all three pairs are in love (A loves B, B loves C, C loves A).

You are given a list ofmknown relationships in the anime. You know for sure that certain pairs love each other, and certain pairs hate each other. You’re wondering how many ways you can fill in the remaining relationships so you are happy with every triangle. Two ways are considered different if two characters are in love in one way but hate each other in the other. Print this count modulo1000000007.

,发光并非太阳的专利,我也可以发光 。

Codeforces Round #309 (Div. 1) C. Love Triangles(二分图)

相关文章:

你感兴趣的文章:

标签云: