문제
Farmer John's pasture can be regarded as a large 2D grid of square "cells" (picture a huge chessboard). Initially, the pasture is empty.
Farmer John will add () cows to the pasture one by one. The th cow will occupy a cell that is distinct from the cells occupied by all other cows ().
A cow is said to be "comfortable" if it is horizontally or vertically adjacent to exactly three other cows. Farmer John is interested in counting the comfortable cows on his farm. For each in the range , output the total number of comfortable cows after the th cow is added to the pasture.
입력
The first line contains a single integer . Each of the next lines contains two space-separated integers, indicating the coordinates of a cow's cell. It is guaranteed that all these cells are distinct.
출력
The th line of output should contain the total number of comfortable cows after the first cows are added to the pasture.
예제 입력 1
8
0 1
1 0
1 1
1 2
2 1
2 2
3 1
3 2
예제 출력 1
0
0
0
1
0
0
1
2
점수
Test cases 1-4 satisfy .Test cases 5-12 satisfy no additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인