A - Flipping Switches Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 233

問題文

高橋君の部屋には N 個の照明があります。それぞれの照明には、ON/OFF を切り替えるスイッチが 1 つずつ付いています。スイッチを 1 回押すたびに、その照明の状態が反転します(ON なら OFF に、OFF なら ON になります)。各照明のスイッチはその照明のみに影響し、他の照明の状態は変化しません。

各照明の初期状態(ON または OFF)は文字列 S_i で与えられます。S_iYes のとき照明 i の初期状態は ON を、No のとき初期状態は OFF を表します。

高橋君はこれから、各照明 i1 \leq i \leq N)について、i 番目の照明のスイッチをちょうど K_i 回押します。

すべてのスイッチ操作を終えた後の、各照明の最終的な状態を求めてください。

制約

  • 1 \leq N \leq 10^5
  • S_iYes または No のいずれかである
  • 1 \leq K_i \leq 10^9
  • N, K_i はすべて整数である

入力

N
S_1 K_1
S_2 K_2
\vdots
S_N K_N
  • 1 行目には、照明の数を表す整数 N が与えられる。
  • 続く N 行のうち i 行目には、i 番目の照明の初期状態を表す文字列 S_i と、スイッチを押す回数を表す整数 K_i が、スペース区切りで与えられる。

出力

N 行出力せよ。i 行目には、i 番目の照明の最終的な状態が ON であれば Yes を、OFF であれば No を出力せよ。


入力例 1

3
Yes 1
No 2
Yes 3

出力例 1

No
No
No

入力例 2

4
Yes 2
No 1
No 4
Yes 5

出力例 2

Yes
Yes
No
No

入力例 3

6
Yes 100
No 99
Yes 1000000
No 999999
Yes 42
No 7

出力例 3

Yes
Yes
Yes
Yes
Yes
Yes

入力例 4

10
Yes 1000000000
No 1000000000
Yes 999999999
No 999999999
Yes 1
No 1
Yes 2
No 2
Yes 500000000
No 500000001

出力例 4

Yes
No
No
Yes
No
Yes
Yes
No
Yes
Yes

入力例 5

1
No 1

出力例 5

Yes

Score : 233 pts

Problem Statement

There are N lights in Takahashi's room. Each light has a single switch that toggles it ON/OFF. Each time a switch is pressed, the state of that light is flipped (ON becomes OFF, and OFF becomes ON). Each light's switch only affects that light and does not change the state of any other light.

The initial state (ON or OFF) of each light is given by a string S_i. When S_i is Yes, the initial state of light i is ON, and when S_i is No, the initial state is OFF.

Takahashi will now press the switch of light i exactly K_i times for each light i (1 \leq i \leq N).

Determine the final state of each light after all switch operations are completed.

Constraints

  • 1 \leq N \leq 10^5
  • S_i is either Yes or No
  • 1 \leq K_i \leq 10^9
  • N, K_i are all integers

Input

N
S_1 K_1
S_2 K_2
\vdots
S_N K_N
  • The first line contains an integer N representing the number of lights.
  • In the following N lines, the i-th line contains a string S_i representing the initial state of the i-th light and an integer K_i representing the number of times the switch is pressed, separated by a space.

Output

Output N lines. On the i-th line, output Yes if the final state of the i-th light is ON, or No if it is OFF.


Sample Input 1

3
Yes 1
No 2
Yes 3

Sample Output 1

No
No
No

Sample Input 2

4
Yes 2
No 1
No 4
Yes 5

Sample Output 2

Yes
Yes
No
No

Sample Input 3

6
Yes 100
No 99
Yes 1000000
No 999999
Yes 42
No 7

Sample Output 3

Yes
Yes
Yes
Yes
Yes
Yes

Sample Input 4

10
Yes 1000000000
No 1000000000
Yes 999999999
No 999999999
Yes 1
No 1
Yes 2
No 2
Yes 500000000
No 500000001

Sample Output 4

Yes
No
No
Yes
No
Yes
Yes
No
Yes
Yes

Sample Input 5

1
No 1

Sample Output 5

Yes