# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
976380 | vjudge1 | 별들과 삼각형 (IZhO11_triangle) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define bismillah ios_base::sync_with_stdio(0); cin.tie(0);
#define int long long
#define v vector
#define pb push_back
#define ppb pop_back
#define all(x) x.begin(), x.end()
#define rall(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define tc int t = 1; while (t--)
// #define tc int t; cin >> t; while (t--)
const int MOD = 1e9 + 7;
const int INF = 1e17;
using namespace std;
int yp[300000], yn[300000], xp[300000], xn[300000];
signed main(){
bismillah;
tc {
//input
int n; cin >> n;
int coordX[n + 1], coordY[n + 1];
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
if (x >= 0)
xp[x]++;
else
xn[-x]++;
if (y >= 0)
yp[y]++;
else
yn[-y]++;
coordX[i] = x;
coordY[i] = y;
}
//solve
int ans = 0;
for (int i = 0; i < n; i++) {
ans += (xp[coordX[i]] + xn[coordX[i]] - 1) * (yp[coordY[i]] + yn[coordY[i]] - 1);
}
//output
cout << ans << endl;
}
}