Submission #976478

# Submission time Handle Problem Language Result Execution time Memory
976478 2024-05-06T15:18:34 Z vjudge1 Star triangles (IZhO11_triangle) C++17
100 / 100
281 ms 13208 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define pll pair<ll,ll>

const ll MOD=1e9+7;

//#define ll int
//KALAU TAKUT RTE

bool cmp (pair<ll,ll> x, pair<ll,ll>y){
	return x.second < y.second;
}

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n; cin>>n;
	ll x[n+1], y[n+1];
	map<ll,ll> cntx, cnty;
	for (int i=1; i<=n;i++){
		cin>>x[i]>>y[i];
		cntx[x[i]]++; cnty[y[i]]++;
	}
	
	ll ans=0;
	for (int i=1; i<=n;i++){
		ans+= (cntx[x[i]]-1) * (cnty[y[i]]-1);
	}
	cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 408 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 376 KB Output is correct
12 Correct 7 ms 1088 KB Output is correct
13 Correct 5 ms 1372 KB Output is correct
14 Correct 8 ms 1884 KB Output is correct
15 Correct 87 ms 7228 KB Output is correct
16 Correct 93 ms 7628 KB Output is correct
17 Correct 86 ms 7440 KB Output is correct
18 Correct 86 ms 7252 KB Output is correct
19 Correct 233 ms 12804 KB Output is correct
20 Correct 170 ms 10324 KB Output is correct
21 Correct 251 ms 13060 KB Output is correct
22 Correct 281 ms 13208 KB Output is correct