#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pb push_back
#define epb emplace_back
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define inf 1e9+1
#define linf 1e18+1
using namespace std;
int dp[100001][101];
map<ll,ll>usedx,usedy;
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n;cin>>n;
int x[n+1],y[n+1];
for(int i=1;i<=n;i++)cin>>x[i]>>y[i];
for(int i=1;i<=n;i++){
usedx[x[i]]++;
usedy[y[i]]++;
}
ll ans=0;
for(int i=1;i<=n;i++){
ans+=(usedx[x[i]]-1)*(usedy[y[i]]-1);
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
328 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
0 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
6 ms |
1100 KB |
Output is correct |
13 |
Correct |
5 ms |
1120 KB |
Output is correct |
14 |
Correct |
9 ms |
1576 KB |
Output is correct |
15 |
Correct |
95 ms |
7108 KB |
Output is correct |
16 |
Correct |
102 ms |
7412 KB |
Output is correct |
17 |
Correct |
98 ms |
7136 KB |
Output is correct |
18 |
Correct |
110 ms |
7108 KB |
Output is correct |
19 |
Correct |
305 ms |
12576 KB |
Output is correct |
20 |
Correct |
206 ms |
10300 KB |
Output is correct |
21 |
Correct |
276 ms |
13140 KB |
Output is correct |
22 |
Correct |
292 ms |
13340 KB |
Output is correct |