62182023-11-08 10:47:40Error42Csodálatos Csillagképekcpp17Accepted 100/100722ms92180 KiB
// Code of EsVagy, only corrected by Error42

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

struct star
{
	int x, y;
};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	map<int, set<int>> rows;
	map<int, set<int>> cols;
	vector<star> stars;

	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		star s;
		cin >> s.x >> s.y;

		stars.push_back(s);

		rows[s.y].insert(s.x);
		cols[s.x].insert(s.y);
	}

	long int ans = 0;

	for (star s : stars)
	{
		ans += (rows[s.y].size() - 1) * (cols[s.x].size() - 1);
	}

	cout << ans << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
subtask225/25
2Accepted3ms2212 KiB
3Accepted3ms2536 KiB
4Accepted3ms2780 KiB
5Accepted3ms2932 KiB
subtask340/40
6Accepted4ms3336 KiB
7Accepted4ms3500 KiB
8Accepted3ms3588 KiB
9Accepted4ms3556 KiB
10Accepted3ms3508 KiB
11Accepted4ms4052 KiB
subtask435/35
12Accepted43ms14376 KiB
13Accepted695ms90048 KiB
14Accepted263ms49760 KiB
15Accepted67ms20916 KiB
16Accepted97ms28644 KiB
17Accepted435ms74000 KiB
18Accepted104ms30076 KiB
19Accepted143ms36784 KiB
20Accepted680ms88860 KiB
21Accepted722ms92180 KiB