Submission #886830

#TimeUsernameProblemLanguageResultExecution timeMemory
886830karimovStar triangles (IZhO11_triangle)C++17
100 / 100
445 ms29652 KiB
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fio(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout)
void YES(bool t=1){std::cout<<(t?"YES\n":"NO\n");}
void NO(bool t=1){YES(!t);}
const int MOD = 1000000007;
#define int long long
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()

void solve() {
	int n; cin >> n;
	map<int,int> a,b;
	map<pair<int,int>,bool> mp;
	int cnt=0;
	while(n--) {
		int x,y;
		cin >> x >> y;
		a[x]++;
		b[y]++;
		mp[{x,y}]=true;
	}
	for(auto it : mp){
		cnt+=(a[it.first.first]-1)*(b[it.first.second]-1);
	}
	cout<<cnt;
}

signed main() {
	FAST
	solve();
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...