제출 #340859

#제출 시각아이디문제언어결과실행 시간메모리
340859Edbert2397별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
400 ms12472 KiB
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
#define pii pair<int,int>
const int N = 3e5 + 5;
const int INF = 1e9;
const ll mod = 1e9+7;
int x[N],y[N];
map<int,int>row,col;
int n;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("triangles.in","r",stdin);
    //freopen("triangles.out","w",stdout);
    cin>>n;
    for(int i = 1;i<=n;i++){
        cin>>x[i]>>y[i];
        row[x[i]]++;
        col[y[i]]++;
    }
    ll ans = 0;
    for(int i = 1;i<=n;i++){
        ans += (1LL * (row[x[i]]-1) * (col[y[i]]-1));
    }
    cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...