Advertisement
Alexandre_lsv

Untitled

Mar 7th, 2016
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <list>
  3. #include <fstream>
  4. #include <algorithm>
  5. #include <cmath>
  6. #include <cstdlib>
  7. #include <iomanip>
  8. #include <map>
  9. #include <set>
  10. #define eps 0.1
  11. using namespace std;
  12. long long prod(long long x){
  13. long long t=0;
  14. long long res=1;
  15. while(true){
  16. res*=x%10;
  17. x/=10;
  18. if (x==0)
  19. break;
  20. }
  21. return res;
  22. }
  23. int max1(int x, int y){
  24. return (x>y?x:y);
  25. }
  26. int min1(int x, int y){
  27. return (x<y?x:y);
  28. }
  29. long long func1(long long x){
  30. return (x*(x-1))/2;
  31. }
  32. int main()
  33. {
  34. //ifstream fin("file.in");
  35. //ofstream fout("file.out");
  36. long long n, m;
  37. long long res=0;
  38. long long min, max;
  39.  
  40.  
  41. // cin.sync_with_stdio(false);
  42. //cout.sync_with_stdio(false);
  43. //int[] sett;
  44. //map<int, int> mapp;
  45. int massx[300000]={};
  46. int massy[300000]={};
  47. bool b1[300000]={};
  48. cin >> n;
  49. int ll;
  50. long long tres=0;
  51. long long resx=0;
  52. long long resy=0;
  53. map<long long, long long> mappx;
  54. map<long long, long long> mappy;
  55. map<pair<long long, long long>, long long> tmapp;
  56. long long xx, yy;
  57. for (int i=0; i<n; i++){
  58. cin >> xx >> yy;
  59. mappx[xx]++;
  60. mappy[yy]++;
  61. tmapp[{xx,yy}]++;
  62. }
  63. for (int i=0; i<n; i++)
  64. //cout << mass[i];
  65. max;
  66. for(auto&mm:mappx){
  67. resx+=func1(mm.second);
  68. }
  69. for(auto&mm:mappy){
  70. resy+=func1(mm.second);
  71. }
  72. for(auto&mm:tmapp){
  73. tres+=func1(mm.second);
  74. }
  75.  
  76. bool b;
  77. int prev;
  78.  
  79. cout << resy+resx-tres;
  80. //fin.close();
  81. //fout.close();
  82. return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement