-
Notifications
You must be signed in to change notification settings - Fork 0
/
supercentral_point.cpp
38 lines (29 loc) · 985 Bytes
/
supercentral_point.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
vector<pair<int,int>> points;
int total=0, n, x, y;
bool right, left, upper, lower;
cin >> n;
for (size_t i = 0; i < n; i++) {
cin >> x >> y;
points.push_back(make_pair(x, y));
}
for (size_t i = 0; i < n; i++) {
right = left = upper = lower = false;
for (size_t j = 0; j < n and (!right or !left or !upper or !lower); j++) {
if(points[i].first > points[j].first and points[i].second == points[j].second)
right = true;
if(points[i].first < points[j].first and points[i].second == points[j].second)
left = true;
if(points[i].first == points[j].first and points[i].second < points[j].second)
upper = true;
if(points[i].first == points[j].first and points[i].second > points[j].second)
lower = true;
}
if(upper and lower and left and right)
total++;
}
cout << total << endl;
return 0;
}