Submission #975882

#TimeUsernameProblemLanguageResultExecution timeMemory
975882vjudge1별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
264 ms9040 KiB
#include <bits/stdc++.h>
using namespace std;
#define futaba ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rio return 0;
#define ll long long

// Fun things are fun. //

ll x[300005], y[300005];

int main() {
    // freopen("generate.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    futaba
    int n;
    cin >> n;
    map<ll, ll> cntx, cnty;
    for(int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
        cntx[x[i]]++;
        cnty[y[i]]++;
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++) ans += ((cntx[x[i]] - 1) * (cnty[y[i]] - 1));
    cout << ans << '\n';
    rio
}
#Verdict Execution timeMemoryGrader output
Fetching results...