Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <fstream>
- #include <algorithm>
- #include <cmath>
- #include <cstdlib>
- #include <iomanip>
- #include <map>
- #include <set>
- #define eps 0.1
- using namespace std;
- long long prod(long long x){
- long long t=0;
- long long res=1;
- while(true){
- res*=x%10;
- x/=10;
- if (x==0)
- break;
- }
- return res;
- }
- int max1(int x, int y){
- return (x>y?x:y);
- }
- int min1(int x, int y){
- return (x<y?x:y);
- }
- long long func1(long long x){
- return (x*(x-1))/2;
- }
- int main()
- {
- //ifstream fin("file.in");
- //ofstream fout("file.out");
- long long n, m;
- long long res=0;
- long long min, max;
- // cin.sync_with_stdio(false);
- //cout.sync_with_stdio(false);
- //int[] sett;
- //map<int, int> mapp;
- int massx[300000]={};
- int massy[300000]={};
- bool b1[300000]={};
- cin >> n;
- int ll;
- long long tres=0;
- long long resx=0;
- long long resy=0;
- map<long long, long long> mappx;
- map<long long, long long> mappy;
- map<pair<long long, long long>, long long> tmapp;
- long long xx, yy;
- for (int i=0; i<n; i++){
- cin >> xx >> yy;
- mappx[xx]++;
- mappy[yy]++;
- tmapp[{xx,yy}]++;
- }
- for (int i=0; i<n; i++)
- //cout << mass[i];
- max;
- for(auto&mm:mappx){
- resx+=func1(mm.second);
- }
- for(auto&mm:mappy){
- resy+=func1(mm.second);
- }
- for(auto&mm:tmapp){
- tres+=func1(mm.second);
- }
- bool b;
- int prev;
- cout << resy+resx-tres;
- //fin.close();
- //fout.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment