#include <iostream>
#include <fstream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
const long long N = 1000005;
ll n, m, i, j, k, u, v, x, y, z, pat,d,e;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
map <ll, ll> x, y;
pair <ll, ll> a[N];
cin >> n;
for (i = 0; i < n; i++)
{
cin >> a[i].first>>a[i].second;
x[a[i].second]++;
y[a[i].first]++;
}
for (i = 0; i < n; i++)
{
pat += (x[a[i].second]-1 )* (y[a[i].first]-1);
}
cout << pat << endl;
//system("pause");
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
15948 KB |
Output is correct |
2 |
Correct |
8 ms |
15948 KB |
Output is correct |
3 |
Correct |
8 ms |
15948 KB |
Output is correct |
4 |
Correct |
8 ms |
15948 KB |
Output is correct |
5 |
Correct |
7 ms |
15948 KB |
Output is correct |
6 |
Correct |
9 ms |
15948 KB |
Output is correct |
7 |
Correct |
8 ms |
15948 KB |
Output is correct |
8 |
Correct |
8 ms |
15948 KB |
Output is correct |
9 |
Correct |
8 ms |
15948 KB |
Output is correct |
10 |
Correct |
9 ms |
15948 KB |
Output is correct |
11 |
Correct |
8 ms |
15956 KB |
Output is correct |
12 |
Correct |
13 ms |
16608 KB |
Output is correct |
13 |
Correct |
14 ms |
16536 KB |
Output is correct |
14 |
Correct |
17 ms |
16980 KB |
Output is correct |
15 |
Correct |
104 ms |
19848 KB |
Output is correct |
16 |
Correct |
113 ms |
19816 KB |
Output is correct |
17 |
Correct |
108 ms |
21920 KB |
Output is correct |
18 |
Correct |
108 ms |
21976 KB |
Output is correct |
19 |
Correct |
308 ms |
26028 KB |
Output is correct |
20 |
Correct |
223 ms |
24260 KB |
Output is correct |
21 |
Correct |
300 ms |
26580 KB |
Output is correct |
22 |
Correct |
295 ms |
26436 KB |
Output is correct |