/*input
3
0 0
1 0
0 1
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
int power(int a,int b,int m = MOD){
if(b == 0) return 1;
if(b == 1) return a;
int x = power(a,b/2,m)%m;
x = (x*x)%m;
if(b%2) return (x*a)%m;
return x;
}
int n;
pii a[300005];
mii xt,yt;
map<pii,int> d;
void solve(){
cin >> n;
REP(i,n){
int x,y; cin >> x >> y;
a[i] = {x,y};
d[{x,y}] ++;
xt[x] ++;
yt[y] ++;
}
int ans = 0;
for(auto x:d){
pii cur = x.F;
ans += (xt[cur.F]-x.S)*(yt[cur.S]-x.S);
}
cout << ans;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
WL(t) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
6868 KB |
Output is correct |
2 |
Correct |
0 ms |
6868 KB |
Output is correct |
3 |
Correct |
0 ms |
6868 KB |
Output is correct |
4 |
Correct |
0 ms |
6868 KB |
Output is correct |
5 |
Correct |
0 ms |
6868 KB |
Output is correct |
6 |
Correct |
0 ms |
6868 KB |
Output is correct |
7 |
Correct |
0 ms |
6868 KB |
Output is correct |
8 |
Correct |
0 ms |
6868 KB |
Output is correct |
9 |
Correct |
0 ms |
6868 KB |
Output is correct |
10 |
Correct |
0 ms |
6868 KB |
Output is correct |
11 |
Correct |
0 ms |
7000 KB |
Output is correct |
12 |
Correct |
6 ms |
8056 KB |
Output is correct |
13 |
Correct |
9 ms |
8056 KB |
Output is correct |
14 |
Correct |
19 ms |
8584 KB |
Output is correct |
15 |
Correct |
319 ms |
17032 KB |
Output is correct |
16 |
Correct |
313 ms |
17560 KB |
Output is correct |
17 |
Correct |
303 ms |
17032 KB |
Output is correct |
18 |
Correct |
293 ms |
17032 KB |
Output is correct |
19 |
Correct |
923 ms |
28252 KB |
Output is correct |
20 |
Correct |
723 ms |
23368 KB |
Output is correct |
21 |
Correct |
1076 ms |
29704 KB |
Output is correct |
22 |
Correct |
1069 ms |
29704 KB |
Output is correct |