#P2252. 【模板】威佐夫博弈 / [SHOI2002] 取石子游戏

【模板】威佐夫博弈 / [SHOI2002] 取石子游戏

Description

There are two piles of stones, with arbitrary (possibly different) counts. Two players take turns. Each move is one of the following:

  • Remove any number of stones from exactly one pile.
  • Remove the same number of stones from both piles simultaneously.

The player who takes the last stones wins. Given the initial numbers of stones in the two piles, you move first. Assuming both players play optimally, determine whether you will win or lose.

Input Format

The input consists of a single line.

The only line contains two integers a,ba, b, representing the initial numbers of stones.

Output Format

The output consists of a single line.

Output a single integer 11, 00, or 1-1: output 11 if you will win; output 00 if you will lose; output 1-1 if the result cannot be determined.

8 4

1

Hint

Constraints

50%50\% of the testdata satisfy a,b1000a, b \le 1000.

100%100\% of the testdata satisfy a,b109a, b \le 10^9.

Translated by ChatGPT 5