daily pastebin goal
52%
SHARE
TWEET

Tiang Pemancar

a guest Sep 17th, 2011 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdio>
  2. #include <cmath>
  3. #include <cstdlib>
  4. using namespace std;
  5. #define R(i,_a,_b) for(int i=int(_a);i<int(_b);i++)
  6.  
  7. long long hasil;
  8. int n, num1, num2;
  9. int a[510000], b[510000], nx[10000], ny[10000];
  10.  
  11. int main() {
  12.     scanf("%d", &n);
  13.      
  14.     R(i,0,n) {
  15.         scanf("%d%d", &a[i], &b[i]);
  16.         nx[ a[i] ]++; ny[ b[i] ]++;
  17.     }
  18.      
  19.     R(i,0,n) {
  20.         hasil = hasil + (nx[ a[i] ]-1) * (ny[ b[i] ]-1);
  21.     }
  22.      
  23.     printf("%lld\n", hasil);
  24.      
  25.     //scanf("\n");
  26.     return 0;
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top