#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 = 100005;
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 |
1 ms |
1868 KB |
Output is correct |
2 |
Correct |
2 ms |
1872 KB |
Output is correct |
3 |
Correct |
1 ms |
1868 KB |
Output is correct |
4 |
Correct |
1 ms |
1868 KB |
Output is correct |
5 |
Correct |
2 ms |
1872 KB |
Output is correct |
6 |
Correct |
1 ms |
1868 KB |
Output is correct |
7 |
Correct |
1 ms |
1872 KB |
Output is correct |
8 |
Correct |
1 ms |
1872 KB |
Output is correct |
9 |
Correct |
1 ms |
1868 KB |
Output is correct |
10 |
Correct |
2 ms |
1868 KB |
Output is correct |
11 |
Correct |
2 ms |
1868 KB |
Output is correct |
12 |
Correct |
7 ms |
2636 KB |
Output is correct |
13 |
Correct |
6 ms |
2636 KB |
Output is correct |
14 |
Correct |
11 ms |
3104 KB |
Output is correct |
15 |
Correct |
104 ms |
7876 KB |
Output is correct |
16 |
Runtime error |
86 ms |
13764 KB |
Execution killed with signal 11 |
17 |
Halted |
0 ms |
0 KB |
- |