Submission #497134

# Submission time Handle Problem Language Result Execution time Memory
497134 2021-12-22T13:51:48 Z infertechno2 Star triangles (IZhO11_triangle) C++17
100 / 100
689 ms 39516 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll Size=3e5+1;
pair<ll,ll> points[Size];
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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 460 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 9 ms 2352 KB Output is correct
13 Correct 8 ms 2340 KB Output is correct
14 Correct 15 ms 2960 KB Output is correct
15 Correct 178 ms 17080 KB Output is correct
16 Correct 226 ms 18088 KB Output is correct
17 Correct 181 ms 17076 KB Output is correct
18 Correct 213 ms 17116 KB Output is correct
19 Correct 607 ms 36784 KB Output is correct
20 Correct 418 ms 28320 KB Output is correct
21 Correct 689 ms 39516 KB Output is correct
22 Correct 680 ms 39332 KB Output is correct