답안 #497133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
497133 2021-12-22T13:51:09 Z infertechno2 별들과 삼각형 (IZhO11_triangle) C++17
100 / 100
447 ms 45452 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll Size=3e5+1;
pair<ll,ll> points[Size];
unordered_map<ll,set<ll>> x_coord,y_coord;

void solve(){
    ll n,ans=0;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>points[i].first>>points[i].second;
        x_coord[points[i].first].insert(points[i].second);
        y_coord[points[i].second].insert(points[i].first);
    }
    for(ll i=0;i<n;i++){
        ans+=(x_coord[points[i].first].size()-1)*(y_coord[points[i].second].size()-1);
    }
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    while(t--){
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 324 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 0 ms 324 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 448 KB Output is correct
11 Correct 2 ms 464 KB Output is correct
12 Correct 9 ms 2428 KB Output is correct
13 Correct 8 ms 2364 KB Output is correct
14 Correct 8 ms 3156 KB Output is correct
15 Correct 98 ms 18992 KB Output is correct
16 Correct 135 ms 20216 KB Output is correct
17 Correct 109 ms 18892 KB Output is correct
18 Correct 114 ms 18936 KB Output is correct
19 Correct 396 ms 42504 KB Output is correct
20 Correct 287 ms 32336 KB Output is correct
21 Correct 442 ms 45432 KB Output is correct
22 Correct 447 ms 45452 KB Output is correct