답안 #977066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977066 2024-05-07T11:00:05 Z vjudge1 별들과 삼각형 (IZhO11_triangle) C++17
0 / 100
1 ms 6492 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;

//masukin nilai n; trus masukin nilai Xi dan Yi ke array;;
//cari banyak titik yang Xnya sama dengan Xi; dan Ynya sama dengan Yi, terus kaliin;
//tambahin ke ans;

    const int a=3e5;
    ll x[a + 5], y[a + 5];
    ll cntX[a+5], cntY[a+5];

int main(){
    ll n; cin>>n;
    for(ll i=0; i<n; i++){
        cin>>x[i]>>y[i];
        cntX[x[i]]++;
        cntY[x[i]]++;
    }
    ll ans=0;
    for(ll i=0; i<n; i++){
        ans+=(cntX[x[i]]-1)*(cntY[y[i]]-1);
    }
    cout<<ans<<endl;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6492 KB Output is correct
3 Correct 1 ms 6492 KB Output is correct
4 Incorrect 1 ms 6488 KB Output isn't correct
5 Halted 0 ms 0 KB -