HBC24860签到[USACO 2009 Nov G]Lights题解

云中君 算法基础篇 49 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
Bessie and the cows were playing games in the barn, but the power was reset and the lights were all turned off. Help the cows get all the lights back on so they can resume their games.

Bessie and the cows were playing games in the barn, but the power was reset and the lights were all turned off. Help the cows get all the lights back on so they can resume their games. The N (1 <= N <= 35) lights conveniently numbered 1..N and their switches are arranged in a complex network with M (1 <= M <= 595) clever connection between pairs of lights (see below). Each light has a switch that, when toggled, causes that light -- and all of the lights that are connected to it -- to change their states (from on to off, or off to on). Find the minimum number of switches that need to be toggled in order to turn all the lights back on. It's guaranteed that there is at least one way to toggle the switches so all lights are back on.

HBC24860签到[USACO 2009 Nov G]Lights题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: HBC24860签到[USACO 2009 Nov G]Lights题解