#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()
{
cin >> n;
for (int i=1; i<=n; i++)
{
cin >> 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);
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
11 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Halted |
0 ms |
0 KB |
- |