这个主要容易超时吧,转化成0,1就好了,也不会破坏奇偶性。
Python实现:

a, b, c, d = input().split()
lst = ['0','2','4','6','8']
ab = 1 if b == '0' else (0 if a[-1] in lst else 1)
c = 0 if c[-1] in lst else 1
d = 0 if d[-1] in lst else 1
print("YES" if (ab * c + d) % 2 != 0 else "NO")

整体时间复杂度应该是O(1)吧~