Submission #913459

# Submission time Handle Problem Language Result Execution time Memory
913459 2024-01-20T08:01:59 Z daoquanglinh2007 Star triangles (IZhO11_triangle) C++17
100 / 100
417 ms 15700 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int NM = 3e5;

int N, x[NM+5], y[NM+5], ans = 0;
map <int, int> f, g;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin >> N;
	for (int i = 1; i <= N; i++){
		cin >> x[i] >> y[i];
		f[x[i]]++;
		g[y[i]]++;
	}
	for (int i = 1; i <= N; i++){
		ans += (f[x[i]]-1)*(g[y[i]]-1);
	}
	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2564 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 2 ms 2556 KB Output is correct
10 Correct 2 ms 2396 KB Output is correct
11 Correct 2 ms 2556 KB Output is correct
12 Correct 7 ms 3416 KB Output is correct
13 Correct 8 ms 3420 KB Output is correct
14 Correct 11 ms 3684 KB Output is correct
15 Correct 96 ms 10780 KB Output is correct
16 Correct 153 ms 11092 KB Output is correct
17 Correct 167 ms 10784 KB Output is correct
18 Correct 103 ms 10736 KB Output is correct
19 Correct 230 ms 14984 KB Output is correct
20 Correct 252 ms 12884 KB Output is correct
21 Correct 417 ms 15700 KB Output is correct
22 Correct 395 ms 15696 KB Output is correct