Submission #680208

# Submission time Handle Problem Language Result Execution time Memory
680208 2023-01-10T08:53:53 Z Angus_Yeung Star triangles (IZhO11_triangle) C++17
100 / 100
330 ms 15552 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<ll, ll>
typedef long long ll;
const ll MOD = 1000000007LL;
const ll INF = 1e18;
using namespace std;

ll n, x[300010], y[300010], ans;
map<ll, ll> mx, my;

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

	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		mx[x[i]]++;
		my[y[i]]++;
	}
	
	ans = 0;
	for (int i = 1; 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 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 6 ms 1236 KB Output is correct
13 Correct 5 ms 1236 KB Output is correct
14 Correct 9 ms 1784 KB Output is correct
15 Correct 122 ms 7852 KB Output is correct
16 Correct 138 ms 8248 KB Output is correct
17 Correct 112 ms 7880 KB Output is correct
18 Correct 103 ms 7868 KB Output is correct
19 Correct 263 ms 14628 KB Output is correct
20 Correct 214 ms 11724 KB Output is correct
21 Correct 318 ms 15492 KB Output is correct
22 Correct 330 ms 15552 KB Output is correct