제출 #897066

#제출 시각아이디문제언어결과실행 시간메모리
897066ach00Star triangles (IZhO11_triangle)C++14
100 / 100
422 ms19804 KiB
#include <bits/stdc++.h>
using namespace std;
#define X second
#define Y first
int main() {
    vector<pair<long long,long long>> stars;
    map<long long, int> x_count;
    map<long long, int> y_count;
    int n; cin >> n;
    for(int i = 0; i < n; i++) {
        int x,y; cin >> x >> y;
        stars.push_back({y,x});
        x_count[x]++;
        y_count[y]++;
    }
    long long ans = 0;
    for(int i = 0; i < n; i++) {
        ans += max((x_count[stars[i].X]-1),0)*max((y_count[stars[i].Y]-1),0);
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...