Submission #500715

# Submission time Handle Problem Language Result Execution time Memory
500715 2021-12-31T21:34:37 Z aryan12 Star triangles (IZhO11_triangle) C++17
100 / 100
281 ms 15576 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
int32_t main() {
  	ios_base::sync_with_stdio(0);
  	cin.tie(0);
  	int n;
  	cin >> n;
  	vector<pair<int, int> > a(n);
  	map<int, int> x, y;
  	for(int i = 0; i < n; i++) {
      	cin >> a[i].first >> a[i].second;
      	x[a[i].first]++;
      	y[a[i].second]++;
    }
  	int ans = 0;
  	for(int i = 0; i < n; i++) {
      	ans += (x[a[i].first] - 1) * (y[a[i].second] - 1);
    }
  	cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 316 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 7 ms 1224 KB Output is correct
13 Correct 6 ms 1248 KB Output is correct
14 Correct 10 ms 1740 KB Output is correct
15 Correct 111 ms 7812 KB Output is correct
16 Correct 104 ms 8260 KB Output is correct
17 Correct 98 ms 7876 KB Output is correct
18 Correct 97 ms 7836 KB Output is correct
19 Correct 268 ms 14616 KB Output is correct
20 Correct 188 ms 11792 KB Output is correct
21 Correct 275 ms 15428 KB Output is correct
22 Correct 281 ms 15576 KB Output is correct