#include<iostream>
#include<map>
using namespace std;
map<pair<int, int>, int> points;
int pos1[4][2] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1} };
int pos2[4][2] = { {-1, -1}, {-1, 1}, {1, -1}, {1, 1} };
bool isRecycle(int x, int y) {
for (int i = 0; i < 4; ++i) {
if (points.count({ x + pos1[i][0], y + pos1[i][1] }) == 0)
return false;
}
return true;
}
int scoreRecycle(int x, int y) {
int num = 0;
for (int i = 0; i < 4; ++i) {
if (points.count({ x + pos2[i][0], y + pos2[i][1] }) == 1)
num++;
}
return num;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
pair<int, int> point;
cin >> point.first >> point.second;
points[point] = 1;
}
int recycle[5] = { 0 };
for (auto point : points) {
pair<int, int> curPoint = { point.first.first, point.first.second };
int x = point.first.first, y = point.first.second;
if (isRecycle(x, y)) {
int num = scoreRecycle(x, y);
recycle[num]++;
}
}
for (int i = 0; i < 5; ++i) {
cout << recycle[i] << endl;
}
return 0;
}
/*样例
7
1 2
2 1
0 0
1 1
1 0
2 0
0 1
11
9 10
10 10
11 10
12 10
13 10
11 9
11 8
12 9
10 9
10 11
12 11*/
CCF-CSP 2019-12-2 回收站选址
最新推荐文章于 2023-04-28 15:02:47 发布