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

32039번 - Go 2 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB165562.500%

문제

It's the evening before the first day of CEOI 2024 and Křemílek and Vochomůrka are in their room, nervous about what's to come. To pass the time, they decided to play a game of Go. Sadly, neither of them brought a Go board. Luckily Křemílek always carries a matchbox in his pocket and Vochomůrka has an infinite grid in his backpack, which means they can play Go 2!

As the name implies, Go 2 differs from Go in two major ways: The board, and the rules.

Go 2 is played on a square grid. Players take turns placing matches on the grid. A match may be placed on any edge between two squares. If placing a match creates an enclosed area, the player that placed it receives a number of points equal to the area of the enclosed space, and the match is removed. Otherwise, the player receives no points and the match remains on the grid. It is prohibited to place a match in the position where a match was placed previously, even if that match has been removed.

Since computing areas of complex shapes can be difficult, Křemílek and Vochomůrka would like your help with evaluating their game. You will receive the list of all matches placed during their game (ordered as they were played). For each match, you should compute the number of points it was worth.

입력

The first line of input contains the integer $N$ — the number of matches placed. $N$ lines follow, one per match. Each of them contains two numbers, $x_i$ and $y_i,ドル and a character $c_i,ドル separated by spaces. Each corner is identified by an $x$ and $y$ coordinate. If $c$ is x, then the match is placed on the edge between $(x, y)$ and $(x + 1, y)$. If $c$ is y, then the match is placed on the edge between $(x, y)$ and $(x, y + 1)$.

출력

Your program should output $N$ lines, one for each match. It should contain a single number $s_i$ — the number of points the match was worth.

제한

  • 1ドル \leq N \leq 3 \cdot 10^5$
  • 0ドル \leq x_i, y_i \leq 10^8$ (for each $i$ such that 1ドル \leq i \leq N$)
  • 0ドル \leq s_i \leq 10^8$ (for each $i$ such that 1ドル \leq i \leq N$)

서브태스크

번호배점제한
125

$N \leq 30,000円,ドル $x_i, y_i \leq 10,000円$ (for each $i$ such that 1ドル \leq i \leq N$)

225

$x_i, y_i \leq 10,000円$ (for each $i$ such that 1ドル \leq i \leq N$)

325

$N \leq 30,000円$

425

no additional constraints

예제 입력 1

4
0 0 x
0 0 y
1 0 y
0 1 x

예제 출력 1

0
0
0
1

힌트

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2024 > Practice 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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