-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgreetingcard.cpp
64 lines (58 loc) · 1.4 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
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <climits>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
struct pair_hash
{
template <class T1, class T2>
std::size_t operator () (std::pair<T1, T2> const &pair) const
{
std::size_t h1 = std::hash<T1>()(pair.first);
std::size_t h2 = std::hash<T2>()(pair.second);
return h1 ^ h2;
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
freopen("1.in","r",stdin);
ll n; cin >> n;
unordered_set<pair<ll,ll>, pair_hash> S;
vector<ii> V;
while (n--) {
ll a, b; cin >> a >> b;
S.emplace(a,b);
V.emplace_back(a,b);
}
ll c = 0;
for (auto& [x,y]:V) {
vector<ii> cmp = {
{0, 2018}, {0, -2018}, {2018, 0}, {-2018, 0},
{1680, 1118}, {1680, -1118}, {1118, 1680}, {1118, -1680},
{-1680, 1118}, {-1680, -1118}, {-1118, 1680}, {-1118, -1680},
};
for (auto& [i,j]:cmp) {
ii target = {x+i, y+j};
if (S.find(target) != S.end()) {
c++;
}
}
}
cout << c/2;
}