Submission #1258680

#TimeUsernameProblemLanguageResultExecution timeMemory
1258680thanzTrol (COCI19_trol)C++20
0 / 50
1 ms328 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define fs first
#define sc second
#define pb push_back
#define int ll

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    map<int, int> mpx, mpy;
    vector<pii> cord(n);
    for (int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        cord[i] = {x, y};
        mpx[x]++;
        mpy[y]++;
    }
    int ans = 0;
    for (auto [x, y] : cord)
    {
        ans += (mpx[x] - 1) * (mpy[y] - 1);
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...