제출 #1338399

#제출 시각아이디문제언어결과실행 시간메모리
1338399iamhereforfun별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
868 ms24648 KiB
// Starcraft 2 enjoyer //

#include <bits/stdc++.h>

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

using namespace std;

#define LSOne(X) ((X) & -(X))

const int N = 3e5 + 5;
const int K = 1e2 + 5;
const int LG = 20;
const int INF = 1e9 + 5;
const int B = 1000;
const int MOD = 1e9 + 7;

int n;
long long ans;
pair<int, int> points[N];
map<int, int> cntx, cnty;
map<pair<int, int>, int> cnt;

inline void solve()
{
    cin >> n;
    for (int x = 0; x < n; x++)
    {
        cin >> points[x].first >> points[x].second;
        cnt[points[x]]++;
        cntx[points[x].first]++;
        cnty[points[x].second]++;
    }
    ans = 0;
    for (int x = 0; x < n; x++)
    {
        ans += 1LL * (cntx[points[x].first] - cnt[points[x]]) * (cnty[points[x].second] - cnt[points[x]]);
    }
    cout << ans << "\n";
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // prep();
    int t = 1;
    // cin >> t;
    for (int x = 1; x <= t; x++)
    {
        solve();
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...