Binary Sequence
Practice
3.3 (116 votes)
Ad Hoc
Easy
Getting started
Number theory
Python
Problem
78% Success 15001 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Given four integers $$x, y, a$$ and $$b$$. Determine if there exists a binary string having $$x$$ 0's and $$y$$ 1's such that the total number of subsequences equal to the sequence "01" in it is $$a$$ and the total number of subsequences equal to the sequence "10" in it is $$b$$.

A binary string is a string made of the characters '0' and '1' only.

A sequence $$a$$ is a subsequence of a sequence $$b$$ if $$a$$ can be obtained from $$b$$ by deletion of several (possibly, zero or all) elements.

Input Format

The first line contains a single integer $$T$$ ($$1 \le T \le 10^5$$), denoting the number of test cases.

Each of the next $$T$$ lines contains four integers $$x$$, $$y$$, $$a$$ and $$b$$ (($$1 \le x, y \le 10^5$$, ($$0 \le a, b \le 10^9$$)), as described in the problem.

Output Format

For each test case, output "Yes'' (without quotes) if a string with given conditions exists and "No'' (without quotes) otherwise.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
No similar problems found