One day Vasya painted a Cartesian coordinate system on a piece of paper and marked some set of points (x1, y1), (x2, y2), ..., (xn, yn). Let's define neighbors for some fixed point from the given set (x, y):

  • point (x', y') is (x, y)'s right neighbor, if x' > x and y' = y
  • point (x', y') is (x, y)'s left neighbor, if x' < x and y' = y
  • point (x', y') is (x, y)'s lower neighbor, if x' = x and y' < y
  • point (x', y') is (x, y)'s upper neighbor, if x' = x and y' > y

We'll consider point (x, y) from the given set supercentral, if it has at least one upper, at least one lower, at least one left and at least one right neighbor among this set's points.

Vasya marked quite many points on the paper. Analyzing the picture manually is rather a challenge, so Vasya asked you to help him. Your task is to find the number of supercentral points in the given set.

Input

The first input line contains the only integer n (1 ≤ n ≤ 200) — the number of points in the given set. Next n lines contain the coordinates of the points written as "x y" (without the quotes) (|x|, |y| ≤ 1000), all coordinates are integers. The numbers in the line are separated by exactly one space. It is guaranteed that all points are different.

Output

Print the only number — the number of supercentral points of the given set.

题解:

判断一个点有没有被东西南北四个点包围 O(n^2)

s

 #include<stdio.h>
struct node{
int x;
int y;
}points[];
int main() {
int n ;
scanf("%d",&n);
for(int i = ; i < n; i++) {
scanf("%d %d",&points[i].x,&points[i].y);
}
int ans = ;
for(int i = ; i < n; i++) {
int a = ;
int b = ;
int c = ;
int d = ;
for(int j = ; j < n; j++) {
if(i == j) continue;
if(points[j].y == points[i].y && points[i].x < points[j].x) a = ; //right
else if(points[j].y == points[i].y && points[i].x > points[j].x) b = ; //left
else if(points[j].y > points[i].y && points[i].x == points[j].x) c = ; //up
else if(points[j].y < points[i].y && points[i].x == points[j].x) d = ; //down if((a + b + c + d )== ) {
ans++;
break;
} }
}
printf("%d\n",ans); return ;
}

A - Supercentral Point CodeForces - 165A的更多相关文章

  1. Codeforces Round #112 (Div. 2)---A. Supercentral Point

    Supercentral Point time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. codeforces A. Supercentral Point 题解

    版权声明:本文作者靖心,靖空间地址:http://blog.csdn.net/kenden23/,未经本作者同意不得转载. https://blog.csdn.net/kenden23/article ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. 干掉H5audio音频标签的下载按钮

    audio::-internal-media-controls-download-button {display:none;}audio::-webkit-media-controls {overfl ...

  2. GAN Generative Adversarial Network 生成式对抗网络-相关内容

    参考: https://baijiahao.baidu.com/s?id=1568663805038898&wfr=spider&for=pc Generative Adversari ...

  3. 专题开发十二:JEECG微云高速开发平台-基础用户权限

      专题开发十二:JEECG微云高速开发平台-基础用户权限 11.3.4自己定义button权限 Jeecg中.眼下button权限设置,是通过对平台自己封装的button标签(<t:dgFun ...

  4. 使用命令行工具提升cocos2d-x开发效率 之CocosBuilder篇

    http://www.cnblogs.com/flyFreeZn/p/3617983.html 假设你正在使用CocosBuilder或者是其它基于CocosBuilder源代码改装而成的工具为你的游 ...

  5. Servlet学习总结,为理解SpringMVC底层做准备

    Servlet 一句话概括 :处理web浏览器,其他HTTP客户端与服务器上数据库或其他应用交互的中间层 Servlet 生命周期 : 1.类加载, 2.实例化并调用init()方法初始化该 Serv ...

  6. 【内存数据库】OracleTimesten连接DSN创建用户

    ************************************************************************ ****原文:blog.csdn.net/clark_ ...

  7. PL/SQL Developer导入导出Oracle数据库方法

    前一篇博客介绍了Navicat工具备份Oracle的方法.这篇博客介绍一下使用PL/SQL Developer工具导入导出Oracle数据库的方法. PL/SQL Developer是Oracle数据 ...

  8. [办公应用]从美国带回来的兄弟牌brother打印机如何处理

    周末帮朋友去调一台国外带回来的brother一体机,型号MFC-J630W.这是她单位老板从国外带回来的,说是便宜:不过她说只有英文说明书,她不太会操作.我想这还不容易么,就满口答应下来了.我先到br ...

  9. [办公应用]如何在WORD中让英文网址可以在字符中间换行

    有时候我们写文章,存在中英文混合录入的情况.一般情况下,office 2003的word软件中,会自作聪明的避免单词断行显示,也就是说它会默认尽量把一个单词显示在某一行内,从而避免单词被分开.但有时候 ...

  10. asp.net mvc + javascript生成下载文件

    近期做的是对现有项目进行重构.WEB FROM改成MVC,其实也算是推倒重来了. 里面有一个导出功能,将数据输出成txt文件,供下载.原先的做法是有一个隐藏的iframe,在这个iframe的页面中设 ...