Submission #336951

# Submission time Handle Problem Language Result Execution time Memory
336951 2020-12-17T13:05:15 Z kutbilim_one Star triangles (IZhO11_triangle) C++14
100 / 100
423 ms 9708 KB
/** @kutbilimone **/
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define all(x) x.begin(),x.end()
#define int long long

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;

	int x[n], y[n];
	map<int, int> cntx, cnty;
	for(int i = 0; i < n; i++){
		cin >> x[i] >> y[i];
		cntx[x[i]]++, cnty[y[i]]++;
	}

	int res = 0;
	for(int i = 0; i < n; i++){	
		res += (cntx[x[i]]-1) * (cnty[y[i]]-1);		
	}

	cout << res << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 7 ms 1260 KB Output is correct
13 Correct 7 ms 1260 KB Output is correct
14 Correct 12 ms 1772 KB Output is correct
15 Correct 138 ms 6272 KB Output is correct
16 Correct 148 ms 6380 KB Output is correct
17 Correct 139 ms 6124 KB Output is correct
18 Correct 138 ms 6252 KB Output is correct
19 Correct 376 ms 9196 KB Output is correct
20 Correct 281 ms 8172 KB Output is correct
21 Correct 412 ms 9708 KB Output is correct
22 Correct 423 ms 9580 KB Output is correct