Problem: Link, Submission: 280673288

**Code**

```
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
int n; cin >> n;
vector<vector<int>> g(2001);
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) {
int u, v;
cin >> u >> v;
a[i].first = u + 1000;
a[i].second = v + 1000;
g[u + 1000].push_back(v + 1000);
g[v + 1000].push_back(u + 1000);
}
int ans = 0;
for (int i = 0; i < n; i++) {
int x = a[i].first;
int y = a[i].second;
bool l = 0, r = 0, u = 0, d = 0;
for (auto k : g[y]) {
if (k > x) {
r = 1;
} else if (k < x) {
l = 1;
}
}
for (auto k : g[x]) {
if (k > y) {
u = 1;
} else if (k < y) {
d = 1;
}
}
if (l == 1 and r == 1 and u == 1 and d == 1) {
ans += 1;
}
}
std::cout << ans << "\n";
return 0;
}
```

I'm sorry but function definition is wrong: do try this:

`public static void main(String args[])`

It is C++ bro.

just brute force bro. Link

You have to split your vector g into two separate vectors, one for horizontal, and one vertical. Given input:

Spoileryour code would say that (0, 0) is a "supercentral point" because there exist smaller and bigger xs and ys than 0, but really there is no "right neighbour" of that point

Thank you for providing the testcase, now I understood my error.

Your approach is not correct. You are just checking for left , right, up and down points. But the condition says that they have to be

directleft, right, up and down points.`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`

So, before checking

`x > x '`

or`x < x'`

you have to check`y == y'`

.Similarly you also need to check

`x == x'`

for`y > y'`

and`y < y'`

to be valid.So, if you really want to use this approach, you can use two seperate

gvectorsgxandgy.see my edited submission of your code here 280712862. (accepted)

just check all the points. 200 is not that much points. My submission 280695175.

Yeah, my approach was wrong. Thanks for the correction and the new solution.