Submission #1087905

#TimeUsernameProblemLanguageResultExecution timeMemory
1087905LilPlutonStar triangles (IZhO11_triangle)C++14
100 / 100
389 ms15660 KiB
#include <bits/stdc++.h>
using namespace std;
#define int ll 
#define ll long long
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
const int sz = 1e5 + 5;

signed main(){
    int n;
    cin >> n;
    vector<pair<int,int>>a(n);
    map<int,int> cx, cy;
    for(int i = 0; i < n; ++i){
        cin >> a[i].first >> a[i].second;
        cx[a[i].first]++;
        cy[a[i].second]++;
    }       
    int res = 0;
    for(int i = 0; i < n; ++i){
        int x, y;
        tie(x, y) = a[i];
        res += ((cx[x] - 1) * (cy[y] - 1));
    }
    cout << res << endl;
    

}
#Verdict Execution timeMemoryGrader output
Fetching results...