fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int t,flag=1;
  6. unsigned long long x,y;
  7. scanf("%d",&t);
  8. while(t--){
  9. scanf("%llu %llu",&x,&y);
  10. flag=1;
  11. if(x==0 && y==0){flag=1;}
  12. else if(x==0){
  13. if(y%2!=0){flag=0;}
  14. }
  15. else if(y==0){
  16. if(x<0 && x%2!=0){flag=0;}
  17. else if(x>0 && x%2==0){flag=0;}
  18. }
  19.  
  20. else if(x>0){
  21. if(x%2==0){
  22. if(y%2!=0){flag=0;}
  23. }
  24. else if(x%2!=0){
  25. if(y%2!=0){
  26. if(y>0 && y>x){
  27. flag=0;
  28. }
  29. else if(y<0){
  30. y=y*(-1);
  31. if(x<=y){flag=0;}
  32. }
  33. }
  34. }
  35. }
  36. else if(x<0){
  37. x=x*(-1);
  38. if(x%2==0){
  39. if(y<0 && y%2!=0){
  40. y=y*(-1);
  41. if(y>x)flag=0;}
  42. }
  43. else if(x%2!=0){
  44. if(y%2!=0){flag=0;}
  45. else if(y%2==0 && y>0 && y<x){flag=0;}
  46. else if(y%2==0 && y<0){
  47. y=y*(-1);
  48. if(y<x){flag=0;}
  49. }
  50. }
  51. }
  52. if(flag==1){printf("YES\n");}
  53. else if(flag==0){printf("NO\n");}
  54.  
  55.  
  56. }//wh
  57.  
  58.  
  59. return 0;
  60. }
Success #stdin #stdout 0s 2296KB
stdin
5
3 0
-2 0
-2 2
-1 0
-3 5
stdout
YES
NO
YES
YES
YES