#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(0), cin.tie(0)
using namespace std;
int arr[4000][4];
int n;
void input() {
fastio;
cin >> n;
for(int i = 0; i < n; ++i)
for(int j = 0; j < 4; ++j)
cin >> arr[i][j];
}
int main() {
input();
vector<int> v;
v.reserve(n*n);
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
v.push_back(arr[i][2] + arr[j][3]);
}
}
sort(v.begin(), v.end());
long long ans = 0;
for(int i = 0; i < n; ++i) {
for(int j = 0; j < n; ++j) {
int target = -(arr[i][0] + arr[j][1]);
ans += upper_bound(v.begin(), v.end(), target) - lower_bound(v.begin(), v.end(), target);
}
}
cout << ans;
}
백준 1062 가르침 혼내주기 (0) | 2021.08.01 |
---|---|
백준 1339 단어 수학 혼내주기 (0) | 2021.08.01 |
백준 2143 두 배열의 합 혼내주기 (0) | 2021.08.01 |
백준 19598 최소 회의실 개수 혼내주기 (0) | 2021.08.01 |
백준 17281 ⚾ 혼내주기 (0) | 2021.08.01 |
댓글 영역