답안 #870417

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
870417 2023-11-07T21:28:33 Z boris_7 별들과 삼각형 (IZhO11_triangle) C++17
0 / 100
0 ms 348 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

void solve(){
    // freopen ("triangles.in","r",stdin);
    // freopen ("triangles.out","w",stdout);

    ll n;
    cin>>n;
    map<ll,ll>x,y;
    vector<pair<int,int>>v;
    for(ll i = 0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        v.push_back({a,b});
        x[a]++;
        y[b]++;
    }
    ll ans = 0;
    for(int i = 0;i<n;i++){
        ans+=(x[v[i].first]-1)*(y[v[i].first]-1);
    }
    cout<<ans<<endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    // ll t;cin>>t;while(t--)
        solve();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -