Submission #336088

#TimeUsernameProblemLanguageResultExecution timeMemory
336088tevdoreStar triangles (IZhO11_triangle)C++14
100 / 100
636 ms6180 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e5 + 10;
int n;
int x[N], y[N];
map < int, int > f1, f2;
ll ans;
main() {
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		f1[x[i]]++;
		f2[y[i]]++;
	}
	for(int i = 1; i <= n; i++) ans += (ll)(f1[x[i]] - 1) * (f2[y[i]] - 1);
	cout << ans << "\n";
}

Compilation message (stderr)

triangle.cpp:9:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main() {
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...