Submission #37260

# Submission time Handle Problem Language Result Execution time Memory
37260 2017-12-23T06:49:16 Z MrPlany Star triangles (IZhO11_triangle) C++14
100 / 100
646 ms 21896 KB
//Bismillahi-rahmani-rahim

#include <bits/stdc++.h>
#include <algorithm>
using namespace std;

typedef long long  ll;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const int inf=1e9;

#define azdar priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>
#define Lebap ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define pf push_front
#define pk pop_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
//#include <conio.h>
#include <climits>
const int N = 1e6+9;

map<ll,int> X,Y;
ll n, x[N],y[N],ans=0;
int main(){
	Lebap;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x[i];
		cin>>y[i];
		X[x[i]]++;
		Y[y[i]]++;
	}
	for(int i=1;i<=n;i++){
		ans += (X[x[i]]-1)*(Y[y[i]]-1);
	}
	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 17804 KB Output is correct
2 Correct 0 ms 17804 KB Output is correct
3 Correct 0 ms 17804 KB Output is correct
4 Correct 0 ms 17804 KB Output is correct
5 Correct 0 ms 17804 KB Output is correct
6 Correct 0 ms 17804 KB Output is correct
7 Correct 0 ms 17804 KB Output is correct
8 Correct 0 ms 17804 KB Output is correct
9 Correct 0 ms 17804 KB Output is correct
10 Correct 0 ms 17804 KB Output is correct
11 Correct 0 ms 17804 KB Output is correct
12 Correct 9 ms 18332 KB Output is correct
13 Correct 6 ms 18332 KB Output is correct
14 Correct 13 ms 18860 KB Output is correct
15 Correct 256 ms 21632 KB Output is correct
16 Correct 273 ms 21764 KB Output is correct
17 Correct 179 ms 21632 KB Output is correct
18 Correct 173 ms 21632 KB Output is correct
19 Correct 629 ms 21896 KB Output is correct
20 Correct 366 ms 21896 KB Output is correct
21 Correct 549 ms 21896 KB Output is correct
22 Correct 646 ms 21896 KB Output is correct