Submission #974622

#TimeUsernameProblemLanguageResultExecution timeMemory
974622vjudge1Star triangles (IZhO11_triangle)C++17
0 / 100
2066 ms4572 KiB
#include <bits/stdc++.h>
using namespace std;

pair <long long, long long> x[300001];
long long n, xi, yi, ans;

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x[i].first >> x[i].second;
	}
	sort(x, x+n);
	for (int i = 0; i < n; i++){
		xi = 0;
		yi = 0;
		for (int j = 0; j < n; j++){
			if(x[i].first == x[j].first && x[i].second == x[j].second){
				continue;
			} else {
				if (x[i].first == x[j].first){
					xi++;
				}
				if (x[i].second == x[j].second){
					yi++;
				}
			}
		}
		ans += xi * yi;
	}
	cout << ans << "\n";
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...