/**
值得纪念,一次通过,还用了STL
**/
#include <iostream>
#include <map>
#include<vector>
//#define debug
using namespace std;
int a[4] = {0};
struct Node{
int x,y;
int score;
bool flag;
};
map<int, vector<struct Node> > m;
vector < struct Node> v;
int main(){
int n,i,j;
for(i = 0;i < 5;i++){
vector < struct Node > tmp;
m[i] = tmp;
}
cin >> n;
for(i = 0;i < n;i++){
struct Node node;
cin >> node.x >> node.y;
v.push_back(node);
}
for(i = 0;i < n;i++){
int ok = 0;
int vx = v[i].x,vy = v[i].y;
for(j = 0;j < n;j++){
if(i!=j){
if( (v[j].x == vx && (v[j].y == vy + 1 || v[j].y == vy - 1)) || (v[j].y == vy && (v[j].x == vx + 1 || v[j].x == vx - 1)))
++ok;
}
}
if(ok == 4){
ok = 0;
v[i].flag =true;
for(j = 0;j < n;j++){
if(i!=j){
if( ( v[j].x - vx == 1 || v[j].x - vx == -1) && (v[j].y - vy == 1 || v[j].y - vy == -1) )
++ok;
}
}
m[ok].push_back(v[i]);
}//if ok
}
for(i = 0;i < 5;i++){
cout << m[i].size() << endl;
}
return 0;
}
CCF(2019-12月)回收站选址
最新推荐文章于 2020-10-21 23:46:27 发布