#include <iostream>
#include <vector>
#include <map>
#include <fstream>
std::ifstream in ("triangles.in");
std::ofstream out ("triangles.out");
using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
std::map<int,int> frecx, frecy;
int const nmax = 300000;
int v[1 + nmax][2];
int main() {
int n;
in >> n;
for(int i = 1;i <= n; i++)
in >> v[i][0] >> v[i][1];
for(int i = 1;i <= n; i++) {
frecx[v[i][0]]++;
frecy[v[i][1]]++;
}
ll result = 0;
for(int i = 1;i <= n; i++)
result += 1LL * (frecx[v[i][0]] - 1) * (frecy[v[i][1]] - 1);
out << result;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |