Advertisement
Saleh127

CF 621B

Oct 6th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. ll a[20000],c[20000],d,e,f=0,i,j,k,x,y;
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11. test
  12. {
  13. cin>>x>>y;
  14. d=x+y;
  15. e=x-y+1000;
  16. a[d]++;
  17. c[e]++;
  18. }
  19. for(i=0;i<3005;i++)
  20. {
  21. f+=(a[i]*(a[i]-1))/2;
  22. f+=(c[i]*(c[i]-1))/2;
  23. }
  24. cout<<f<<endl;
  25. return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement