fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int int64_t
  4. #define endl "\n"
  5. #define fastIO() ios_base::sync_with_stdio(false); cin.tie(NULL);
  6.  
  7. const int N = 1e6+7;
  8. int T, ones, twos, threes;
  9.  
  10. int32_t main()
  11. {
  12. fastIO();
  13. cin >> T;
  14. while (T--)
  15. {
  16. cin >> ones >> twos >> threes;
  17. int x1 = ones % 2 == 0;
  18. int x2 = twos % 2 == 0;
  19. int x3 = threes % 2 == 0;
  20. int d = x1*4 + x2*2 + x3;
  21. switch (d)
  22. {
  23. case 0 :
  24. {
  25. ones -= ones/2;
  26. twos -= twos/2;
  27. threes -= threes/2;
  28. if (threes > 0 || (ones > 0 && twos > 0) || (ones >= 3))
  29. cout << "YES" << endl;
  30. else
  31. cout << "NO" << endl;
  32. break;
  33. }
  34. case 2 :
  35. {
  36. ones -= ones/2;
  37. twos -= twos/2;
  38. threes -= threes/2;
  39. if (twos > 0 || (ones >= 2))
  40. cout << "YES" << endl;
  41. else
  42. cout << "NO" << endl;
  43. break;
  44. }
  45. case 5 :
  46. {
  47. ones -= ones/2;
  48. twos -= twos/2;
  49. threes -= threes/2;
  50. if (ones > 0)
  51. cout << "YES" << endl;
  52. else
  53. cout << "NO" << endl;
  54. break;
  55. }
  56. case 7 :
  57. {
  58. cout << "YES" << endl;
  59. break;
  60. }
  61. default :
  62. {
  63. cout << "NO" << endl;
  64. break;
  65. }
  66. }
  67. }
  68. return 0;
  69. }
Success #stdin #stdout 0s 4512KB
stdin
5
3 3 3
3 2 3
1 1 2
1 0 1
1 1 1
stdout
YES
YES
NO
NO
YES