146082025-01-20 15:27:17GervidCsodálatos Csillagképekcpp17Accepted 100/100763ms27552 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <array>

using namespace std;

int main()
{
	iostream::sync_with_stdio(0);
	cin.tie(0);

	int n, i, j;
	cin >> n;

	map<int, int> row, col;
	map<array<int, 2>, int> points;
	for (i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		row[x]++;
		col[y]++;
		points[{x, y}]++;
	}

	long long ans = 0;
	for (pair<array<int, 2>, int> ps : points)
	{
		int x = ps.first[0], y = ps.first[1];
		ans += ps.second * (row[x] - points[{x, y}])* (col[y] - points[{x, y}]);
	}
	cout << ans;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
subtask225/25
2Accepted1ms316 KiB
3Accepted1ms564 KiB
4Accepted1ms316 KiB
5Accepted1ms316 KiB
subtask340/40
6Accepted2ms316 KiB
7Accepted2ms432 KiB
8Accepted2ms316 KiB
9Accepted2ms356 KiB
10Accepted2ms536 KiB
11Accepted3ms564 KiB
subtask435/35
12Accepted48ms4128 KiB
13Accepted763ms26812 KiB
14Accepted252ms14124 KiB
15Accepted76ms6200 KiB
16Accepted116ms8756 KiB
17Accepted458ms21556 KiB
18Accepted120ms7988 KiB
19Accepted151ms11588 KiB
20Accepted686ms26420 KiB
21Accepted597ms27552 KiB