QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21352. 点滅

Statistics

牛舎の薄暗い照明に不満を持った Farmer John は、$N$ 個($(3 \le N \le 16)$)の電球を円形に並べた豪華な新しいシャンデリアを取り付けました。

牛たちはこの新しい照明に夢中になり、次のゲームを楽しんでいます。時刻 $T$ に、ある電球の左隣の電球が時刻 $T-1$ に点灯していたなら、その電球の点灯・消灯状態を反転させます。このゲームを $B$ 時間単位続けます。$(1 \le B \le 10^{15})$ です。$B$ は標準的な 32 ビット整数に収まらないほど大きい場合があることに注意してください。

電球の初期状態が与えられるので、$B$ 時間単位が経過した後の最終状態を求めてください。

入力

  • 1 行目:空白区切りの 2 つの整数 $N$ と $B$。

  • $2..1+N$ 行目:$i+1$ 行目は電球 $i$ の初期状態で、$0$ は消灯、$1$ は点灯を表します。

出力

  • $1..N$ 行目:$i$ 行目には電球 $i$ の最終状態を出力します。$0$ は消灯、$1$ は点灯です。

入出力例

入力 1

5 6
1
0
0
0
0

出力 1

1
1
1
0
1

注記

電球は五つあります。最初の電球は初め点灯しており、ほかは消灯しています。

電球の状態は次のとおりです。

  • 時刻 $T=0$: 1 0 0 0 0

  • 時刻 $T=1$: 1 1 0 0 0

  • 時刻 $T=2$: 1 0 1 0 0

  • 時刻 $T=3$: 1 1 1 1 0

  • 時刻 $T=4$: 1 0 0 0 1

  • 時刻 $T=5$: 0 1 0 0 1

  • 時刻 $T=6$: 1 1 1 0 1

問題作成:Videh Seksaria と Brian Dean、2013

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.