#P3937. Changing

    ID: 2877 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>数学洛谷原创进制组合数学期望

Changing

Description

There are nn lamps arranged in a circle, labeled clockwise as 1n1 \cdots n. The initial time is 00. At the initial time, the on/off state aia_i of the ii-th lamp is given, where 00 means off and 11 means on. At the next time, each lamp’s state depends on the current state of this lamp and the next lamp in the clockwise direction. If the two lamps have the same state, then at the next time this lamp is off; otherwise, it is on.

Find the state of the kk-th lamp at time tt.

Input Format

The first line contains three integers nn, tt, kk.

The second line contains nn integers, each being 00 or 11, representing aia_i.

Output Format

Output one line with a single number, 00 or 11, representing the state of the kk-th lamp at time tt.

4 2 1
1 0 1 0
0

Hint

  • For 25%25\% of the testdata, 1t,kn10001 \leq t, k \leq n \leq 1000.
  • For 60%60\% of the testdata, 1t,kn1051 \leq t, k \leq n \leq 10^5.
  • For 100%100\% of the testdata, 1t,kn3×1061 \leq t, k \leq n \leq 3 \times 10^6.

Translated by ChatGPT 5