#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
ifstream in("triangles.in");
ofstream out("triangles.out");
const int dim = 3e5 + 5;
int n,lin[dim],col[dim];
pair<int,int> a[dim];
int main()
{
in >> n;
for (int i=1; i<=n; i++)
{
in >> a[i].first >> a[i].second;
lin[a[i].first]++;
col[a[i].second]++;
}
int ans = 0;
for (int i=1; i<=n; i++)
{
ans += (lin[a[i].first] - 1) * (col[a[i].second] - 1);
}
out << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |