Logo
(追記) (追記ここまで)

22932번 - Token Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB (추가 메모리 없음)54322663.415%

문제

Alice and Bob are playing a game on board which is a 2-dimensional 300ドル \times 300$ grid. The board is subdivided into cells. Each cell can be uniquely identified by two integers representing $(x,y)$ coordinates, each in the range from 1ドル$ to 300ドル$.

Two tokens are on the board on distinct cells. Alice starts the game. On each player's turn, that player chooses one of the tokens, chooses one of the coordinates of the cell it's on, and reduces that coordinate by some positive amount. The moved token cannot jump over or occupy the same space as the other token. The token must also remain on the board (so both of its coordinates need to stay positive). The first player unable to make a move loses. Note that both players can move either token.

You are given the starting configuration of a number of games. For each of the games, compute the number of initial winning moves available to Alice.

입력

The first line of input contains a single integer $n$ (1ドル \le n \le 10^5$), which is the number of games to analyze.

Each of the next $n$ lines contains four integers $x_1,ドル $y_1,ドル $x_2$ and $y_2$ (1ドル \le x_1,x_2,y_1,y_2 \le 300,ドル and either $ x_1 \ne x_2$ or $y_1 \ne y_2$ holds). This represents the starting configuration of one game, with the tokens at cells $(x_1,y_1)$ and $(x_2,y_2)$.

출력

Output $n$ lines. On each line, output a single integer, which is the number of initial winning moves available to Alice for one of the input games. Output them in the order of the input.

제한

예제 입력 1

5
6 6 6 3
6 6 2 2
1 6 3 1
3 6 1 3
6 3 1 5

예제 출력 1

3
0
1
1
0

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2021 K번

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 2: The American Contest K번

  • 문제를 만든 사람: Lewin Gan
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /