HBC209449All-StarGame题解

八贝勒 算法基础篇 51 0
全网最全C++题库,助您快速提升编程技能!题库丰富多样,涵盖各个领域,让您在练习中不断成长!
In Apollo's country, basketball is the most popular sport. There are n basketball players and m basketball fans. Bastketball players are numbered from 1 to n. Basketball fans are numbered from 1 to m.

In Apollo's country, basketball is the most popular sport. There are n basketball players and m basketball fans. Bastketball players are numbered from 1 to n. Basketball fans are numbered from 1 to m. A basketball fan can be a fan of multiple players. Basketball fan i is like to watch the game of player j if one of the following conditions is met: Basketball fan i is a fan of basketball player j. There is a fan i' and a player j', both fan i and fan i' are like to watch the game of player j', and fan i' is like to watch the game of player j. The All-Star Game is an annual exhibition basketball game. You need to select some players into the All-Star Game. A fan will watch the All-Star Game if he is like to watch the game of one selected player (i.e. at least one of the players that the fan is like to watch was selected). You need to decide the minimum number of players need to be selected into All-Star Game so that all basketball fans will watch the game. Initially, some basketball players will have some fans. There are q changes to the relationship between basketball players and basketball fans. After each of q changes, print one integer --- the minimum number of players which you have to select to make all basketball fans will watch the game. Print "-1" if it is impossible.

HBC209449All-StarGame题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC209449All-StarGame题解