Submission #227522

# Submission time Handle Problem Language Result Execution time Memory
227522 2020-04-27T16:18:58 Z _ani Star triangles (IZhO11_triangle) C++14
100 / 100
762 ms 13304 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int maxn = 300002;
int n, x[maxn], y[maxn];
map <int, long long> mx, my;
long long ans;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
		mx[x[i]]++;
		my[y[i]]++;
	}
	for (int i = 0; i < n; i++)
	{
		ans += (mx[x[i]] - 1) * (my[y[i]] - 1);
	}
	cout << ans << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 7 ms 384 KB Output is correct
12 Correct 19 ms 1152 KB Output is correct
13 Correct 21 ms 1280 KB Output is correct
14 Correct 27 ms 1732 KB Output is correct
15 Correct 264 ms 7288 KB Output is correct
16 Correct 272 ms 7544 KB Output is correct
17 Correct 242 ms 7160 KB Output is correct
18 Correct 296 ms 7164 KB Output is correct
19 Correct 689 ms 12664 KB Output is correct
20 Correct 473 ms 10360 KB Output is correct
21 Correct 705 ms 13240 KB Output is correct
22 Correct 762 ms 13304 KB Output is correct