Submission #41333

#TimeUsernameProblemLanguageResultExecution timeMemory
41333IvanCStar triangles (IZhO11_triangle)C++14
100 / 100
521 ms42360 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 3*1e5 + 10; typedef long long ll; ll N,ans,c1[MAXN],c2[MAXN]; map<ll,ll> X,Y; int main(){ cin.tie(0);ios_base::sync_with_stdio(0); cin >> N; for(int i = 1;i<=N;i++){ cin >> c1[i] >> c2[i]; X[c1[i]]++; Y[c2[i]]++; } for(int i = 1;i<=N;i++){ ans += (X[c1[i]] - 1)*(Y[c2[i]] - 1); } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...