Submission #976059

# Submission time Handle Problem Language Result Execution time Memory
976059 2024-05-06T06:46:19 Z vjudge1 Star triangles (IZhO11_triangle) C++17
100 / 100
281 ms 9104 KB
#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
#define pb push_back
#define endl '\n'
using namespace std;

int N,x[300003],y[300003],ans;
map<int, int> row;
map<int, int> col;

void solve() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> x[i] >> y[i];
		row[x[i]]++;
		col[y[i]]++;
	}
	for (int i = 1; i <= N; i++) ans += (row[x[i]] - 1) * (col[y[i]] - 1);
	cout << ans << endl;
}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int tttt = 1;
	// cin >> tttt;
	while (tttt--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 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 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 1 ms 2484 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 5 ms 3164 KB Output is correct
13 Correct 6 ms 3164 KB Output is correct
14 Correct 8 ms 3420 KB Output is correct
15 Correct 94 ms 8624 KB Output is correct
16 Correct 99 ms 8672 KB Output is correct
17 Correct 86 ms 8532 KB Output is correct
18 Correct 88 ms 8616 KB Output is correct
19 Correct 231 ms 9040 KB Output is correct
20 Correct 171 ms 8780 KB Output is correct
21 Correct 262 ms 9104 KB Output is correct
22 Correct 281 ms 9040 KB Output is correct