Logo
(追記) (追記ここまで)

5998번 - Lights 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB180564035.714%

문제

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.

입력

  • Line 1: Two space-separated integers: N and M.
  • Lines 2..M+1: Each line contains two space-separated integers representing two lights that are connected. No pair will be repeated.

출력

Line 1: A single integer representing the minimum number of switches that need to be flipped in order to turn on all the lights.

제한

예제 입력 1

5 6
1 2
1 3
4 2
3 4
2 5
5 3

예제 출력 1

3

힌트

There are 5 lights. Lights 1, 4, and 5 are each connected to both lights 2 and 3.

Toggle the switches on lights 1, 4, and 5.

출처

Olympiad > USA Computing Olympiad > 2009-2010 Season > USACO November 2009 Contest > Gold 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /