并查集
know_heng
步步皆题
展开
-
CodeForces - 776D The Door Problem
Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors ar原创 2017-04-11 15:10:12 · 351 阅读 · 0 评论 -
poj 2912(并查集,食物链)
因为和食物链题一样的性质,所以处理和食物链那题一样。 性质: 如果 A>B 并且 B>C 时, 则 A 所以用并查集关系式处理如下 A>B 处理成 F【A】=B,SUM【A】=2; A A==B 处理成 F【A】=B, SUM【A】=0; 例如 A>B, B>C,看此时变化。 先处理 A>B ,F【A】=B,SUM【A】=2; 再处理 B>C,原创 2017-04-02 11:18:39 · 311 阅读 · 0 评论 -
poj 1703(并查集分组)
The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang Dragon and Gang Snake. However, the police first needs to identify which g原创 2017-04-03 17:46:23 · 330 阅读 · 0 评论