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

5831번 - Blink 다국어

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

문제

Unhappy with the dim lighting in his barn, Farmer John has just installed a fancy new chandelier consisting of N (3 <= N <= 16) lights bulbs arranged in a circle.

The cows are fascinated by this new light fixture, and enjoy playing the following game: at time T, they toggle the state of each light bulb if its neighbor to the left was turned on at time T-1. They continue this game for B units of time (1 <= B <= 10^15). Note that B might be too large to fit into a standard 32-bit integer.

Given the initial states of the light bulbs, please determine their final states after B units of time have elapsed.

입력

  • Line 1: Two space-separated integers, N and B.
  • Lines 2..1+N: Line i+1 contains the initial state of bulb i, either 0 (off) or 1 (on).

출력

  • Lines 1..N: Line i should contain the final state of bulb i, either 0 (off) or 1 (on).

제한

예제 입력 1

5 6
1
0
0
0
0

예제 출력 1

1
1
1
0
1

힌트

Input Details

There are five light bulbs. The first is initially on, and the others are off.

Output Details

The light bulb states are as follows:

  • Time T=0: 1 0 0 0 0 Time
  • T=1: 1 1 0 0 0 Time
  • T=2: 1 0 1 0 0 Time
  • T=3: 1 1 1 1 0 Time
  • T=4: 1 0 0 0 1 Time
  • T=5: 0 1 0 0 1 Time
  • T=6: 1 1 1 0 1

출처

Olympiad > USA Computing Olympiad > 2012-2013 Season > USACO US Open 2013 Contest > Bronze 2번

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

출처

대학교 대회

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

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