CF705B.Spider Man

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Peter Parker wants to play a game with Dr. Octopus. The game is about cycles. Cycle is a sequence of vertices, such that first one is connected with the second, second is connected with third and so on, while the last one is connected with the first one again. Cycle may consist of a single isolated vertex.

Initially there are kk cycles, ii -th of them consisting of exactly viv_{i} vertices. Players play alternatively. Peter goes first. On each turn a player must choose a cycle with at least 22 vertices (for example, xx vertices) among all available cycles and replace it by two cycles with pp and xpx-p vertices where 1<=p<x is chosen by the player. The player who cannot make a move loses the game (and his life!).

Peter wants to test some configurations of initial cycle sets before he actually plays with Dr. Octopus. Initially he has an empty set. In the ii -th test he adds a cycle with aia_{i} vertices to the set (this is actually a multiset because it can contain two or more identical cycles). After each test, Peter wants to know that if the players begin the game with the current set of cycles, who wins?

Peter is pretty good at math, but now he asks you to help.

输入格式

The first line of the input contains a single integer nn ( 1<=n<=1000001<=n<=100000 ) — the number of tests Peter is about to make.

The second line contains nn space separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 1<=ai<=1091<=a_{i}<=10^{9} ), ii -th of them stands for the number of vertices in the cycle added before the ii -th test.

输出格式

Print the result of all tests in order they are performed. Print 1 if the player who moves first wins or 2 otherwise.

输入输出样例

  • 输入#1

    3
    1 2 3
    

    输出#1

    2
    1
    1
    
  • 输入#2

    5
    1 1 5 1 1
    

    输出#2

    2
    2
    2
    2
    2
    

说明/提示

In the first sample test:

In Peter's first test, there's only one cycle with 11 vertex. First player cannot make a move and loses.

In his second test, there's one cycle with 11 vertex and one with 22 . No one can make a move on the cycle with 11 vertex. First player can replace the second cycle with two cycles of 11 vertex and second player can't make any move and loses.

In his third test, cycles have 11 , 22 and 33 vertices. Like last test, no one can make a move on the first cycle. First player can replace the third cycle with one cycle with size 11 and one with size 22 . Now cycles have 11 , 11 , 22 , 22 vertices. Second player's only move is to replace a cycle of size 22 with 22 cycles of size 11 . And cycles are 11 , 11 , 11 , 11 , 22 . First player replaces the last cycle with 22 cycles with size 11 and wins.

In the second sample test:

Having cycles of size 11 is like not having them (because no one can make a move on them).

In Peter's third test: There a cycle of size 55 (others don't matter). First player has two options: replace it with cycles of sizes 11 and 44 or 22 and 33 .

  • If he replaces it with cycles of sizes 11 and 44 : Only second cycle matters. Second player will replace it with 22 cycles of sizes 22 . First player's only option to replace one of them with two cycles of size 11 . Second player does the same thing with the other cycle. First player can't make any move and loses.
  • If he replaces it with cycles of sizes 22 and 33 : Second player will replace the cycle of size 33 with two of sizes 11 and 22 . Now only cycles with more than one vertex are two cycles of size 22 . As shown in previous case, with 22 cycles of size 22 second player wins.

So, either way first player loses.

首页