Submission #488711

# Submission time Handle Problem Language Result Execution time Memory
488711 2021-11-20T07:11:31 Z irmuun Star triangles (IZhO11_triangle) C++17
100 / 100
555 ms 15460 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll n,i,a[300001],b[300001],ans=0;
	map<ll,ll>x,y;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		x[a[i]]++;
		y[b[i]]++;
	}
	for(i=1;i<=n;i++){
		ans+=(x[a[i]]-1)*(y[b[i]]-1);
	}
	cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4944 KB Output is correct
2 Correct 2 ms 4944 KB Output is correct
3 Correct 2 ms 4944 KB Output is correct
4 Correct 3 ms 4944 KB Output is correct
5 Correct 2 ms 4944 KB Output is correct
6 Correct 2 ms 4944 KB Output is correct
7 Correct 3 ms 4944 KB Output is correct
8 Correct 2 ms 4944 KB Output is correct
9 Correct 3 ms 4944 KB Output is correct
10 Correct 3 ms 4944 KB Output is correct
11 Correct 5 ms 4944 KB Output is correct
12 Correct 13 ms 5728 KB Output is correct
13 Correct 13 ms 5764 KB Output is correct
14 Correct 18 ms 6284 KB Output is correct
15 Correct 155 ms 10964 KB Output is correct
16 Correct 194 ms 11232 KB Output is correct
17 Correct 182 ms 10952 KB Output is correct
18 Correct 157 ms 10976 KB Output is correct
19 Correct 502 ms 15044 KB Output is correct
20 Correct 332 ms 13368 KB Output is correct
21 Correct 555 ms 15460 KB Output is correct
22 Correct 478 ms 15460 KB Output is correct