Submission #165995

# Submission time Handle Problem Language Result Execution time Memory
165995 2019-11-30T05:02:24 Z Gurban Star triangles (IZhO11_triangle) C++11
100 / 100
1043 ms 15864 KB
#include <bits/stdc++.h>

#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2

using namespace std;

ll n;
ll sum;
pair <ll,ll> a[3 * N];
map <ll,ll> m,p;
map <pair<int,int>,int> k;

int main()
{
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i].ff >> a[i].ss;
		m[a[i].ff]++;
		p[a[i].ss]++;
	}
	for(int i = 1;i <= n;i++)
		sum += ((m[a[i].ff] - (ll)1) * (p[a[i].ss] - (ll)1));
	cout << sum << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 3 ms 404 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 20 ms 1272 KB Output is correct
13 Correct 23 ms 1272 KB Output is correct
14 Correct 29 ms 1784 KB Output is correct
15 Correct 315 ms 8224 KB Output is correct
16 Correct 353 ms 8444 KB Output is correct
17 Correct 333 ms 8112 KB Output is correct
18 Correct 324 ms 7932 KB Output is correct
19 Correct 925 ms 14908 KB Output is correct
20 Correct 654 ms 12024 KB Output is correct
21 Correct 1043 ms 15864 KB Output is correct
22 Correct 1000 ms 15712 KB Output is correct