답안 #870418

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
870418 2023-11-07T21:29:21 Z boris_7 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
251 ms 15360 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].second]-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 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 5 ms 1116 KB Output is correct
13 Correct 5 ms 1388 KB Output is correct
14 Correct 8 ms 1848 KB Output is correct
15 Correct 82 ms 7116 KB Output is correct
16 Correct 88 ms 7588 KB Output is correct
17 Correct 83 ms 7096 KB Output is correct
18 Correct 86 ms 7296 KB Output is correct
19 Correct 225 ms 14780 KB Output is correct
20 Correct 164 ms 10264 KB Output is correct
21 Correct 251 ms 15360 KB Output is correct
22 Correct 243 ms 14784 KB Output is correct