forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgreetingcard.cpp
53 lines (42 loc) · 1.12 KB
/
greetingcard.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
ll count(set<pair<ll, ll>>& s, pair<ll, ll> point) {
int total = 0;
vector<pair<ll, ll>> a;
a.push_back({point.first + 0, point.second + 2018});
a.push_back({point.first + 1118, point.second + 1680});
a.push_back({point.first + 1680, point.second + 1118});
a.push_back({point.first + 2018, point.second + 0});
a.push_back({point.first + 0, point.second - 2018});
a.push_back({point.first + 1118, point.second - 1680});
a.push_back({point.first + 1680, point.second - 1118});
for(auto i : a) {
if(s.count(i) > 0) {
total++;
}
}
return total;
}
int main() {
ll n;
cin >> n;
vector<pair<ll, ll>> v;
set<pair<ll, ll>> s;
for(int i = 0; i < n; i++) {
pair<ll, ll> p;
cin >> p.first >> p.second;
v.push_back(p);
s.insert(p);
}
sort(v.begin(), v.end());
ll total = 0;
for(auto i : v) {
total += count(s, i);
s.erase(i);
}
cout << total << endl;
}