#include <iostream>
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;
#define pb push_back
#define ins insert
#define fr first
#define sc second
const int pi = acos(0) * 2;
const int N = 3e5;
inline void FIXED() {
cout << fixed << setprecision(48);
}
inline double dist(int x1, int x2, int y1, int y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
vector < pair < int, int > > dot;
map < int, vector < int > > vx;
map < int, vector < int > > vy;
map < int, bool > vis;
main()
{
int n, ans = 0;
cin >> n;
for(int i = 1; i <= n; i++)
{
int x, y;
cin >> x >> y;
dot.pb( {x, y} );
vx[x].pb(y);
vy[y].pb(x);
}
for(pair < int, int > i : dot)
{
//vis[i.fr] = 1;
//vis[i.sc] = 1;
ans += (vx[i.fr].size() - 1) * (vy[i.sc].size() - 1);
}
cout << ans << endl;
}
Compilation message
triangle.cpp:29:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main()
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
372 KB |
Output is correct |
3 |
Correct |
2 ms |
576 KB |
Output is correct |
4 |
Correct |
2 ms |
576 KB |
Output is correct |
5 |
Correct |
2 ms |
576 KB |
Output is correct |
6 |
Correct |
2 ms |
576 KB |
Output is correct |
7 |
Correct |
2 ms |
576 KB |
Output is correct |
8 |
Correct |
2 ms |
576 KB |
Output is correct |
9 |
Correct |
2 ms |
576 KB |
Output is correct |
10 |
Correct |
3 ms |
576 KB |
Output is correct |
11 |
Correct |
3 ms |
576 KB |
Output is correct |
12 |
Correct |
18 ms |
1808 KB |
Output is correct |
13 |
Correct |
18 ms |
1808 KB |
Output is correct |
14 |
Correct |
25 ms |
2636 KB |
Output is correct |
15 |
Correct |
286 ms |
8452 KB |
Output is correct |
16 |
Correct |
325 ms |
8836 KB |
Output is correct |
17 |
Correct |
321 ms |
8836 KB |
Output is correct |
18 |
Correct |
317 ms |
8836 KB |
Output is correct |
19 |
Correct |
930 ms |
15116 KB |
Output is correct |
20 |
Correct |
675 ms |
15116 KB |
Output is correct |
21 |
Correct |
1043 ms |
15300 KB |
Output is correct |
22 |
Correct |
914 ms |
15300 KB |
Output is correct |