제출 #914942

#제출 시각아이디문제언어결과실행 시간메모리
914942adaawf별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
246 ms12600 KiB
#include <iostream>
#include <map>
using namespace std;
int a[300005], b[300005];
map<int, int> ma, mb;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        ma[a[i]]++;
        mb[b[i]]++;
    }
    long long int res = 0;
    for (int i = 1; i <= n; i++) {
        res += 1ll * (ma[a[i]] - 1) * (mb[b[i]] - 1);
    }
    cout << res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...