Submission #870417

# Submission time Handle Problem Language Result Execution time Memory
870417 2023-11-07T21:28:33 Z boris_7 Star triangles (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();
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -