这是通化邀请赛的题,当时比赛的时候还完全没想法呢,看来这几个月的训练还是有效果的... 题意要求(1) |ai| < T for all i (2) (vi, vj) in E <=> |ai - aj| >= T.由于(1)条件的存在,所以(2)条件能成立当且仅当ai和aj一正一负.由此可见,图中某条路上的元素正负值分别为正->负->正->负...显然当图中存在奇环的时候是无解的.判断奇环用二分染色,color[i]=0表示假设i节点未被染色,1表示假设i节…
[POJ 2942]Knights of the Round Table(双联通分量+染色判奇环) Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 11661 Accepted: 3824 Description Being a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, an…