Submission #977207

# Submission time Handle Problem Language Result Execution time Memory
977207 2024-05-07T13:53:47 Z suhu88 Star triangles (IZhO11_triangle) C++14
100 / 100
255 ms 15496 KB
#include<bits/stdc++.h>
#define suhu ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
const ll MAXN=3e5+5;
const ll inf=1e18;
ll n,a[MAXN],b[MAXN];
map<ll,ll>x;
map<ll,ll>y;
int main(){
	suhu
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		x[a[i]]++;
		y[b[i]]++;
	}
	
	ll ans=0;
	for(int i=1;i<=n;i++){
		ans+=(x[a[i]]-1)*(y[b[i]]-1);
	}
	cout<<ans<<"\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 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 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 5 ms 3164 KB Output is correct
13 Correct 5 ms 3164 KB Output is correct
14 Correct 8 ms 3676 KB Output is correct
15 Correct 84 ms 8520 KB Output is correct
16 Correct 92 ms 11004 KB Output is correct
17 Correct 97 ms 10832 KB Output is correct
18 Correct 83 ms 10756 KB Output is correct
19 Correct 232 ms 14980 KB Output is correct
20 Correct 180 ms 13080 KB Output is correct
21 Correct 248 ms 15496 KB Output is correct
22 Correct 255 ms 15444 KB Output is correct