Problem list
Log in
#coci00580 · COCI 2020/2021 Contest 4

Vepar

Gold I 1.0 s 256 MB

Two intervals of positive integers {a, $a + 1$, . . . , b} and {c, $c + 1$, . . . , d} are given. Determine whether the product $c$·($c+1$) · · · $d$ is divisible by the product $a$·($a+1$) · · · $b$.

Input

The first line contains a single integer $t$ ($1 \le t \le 10$), the number of independent test cases. Each of the following $t$ lines contains four positive integers $a_{i}$, $b_{i}$, $c_{i}$, $d_{i}$ ($1 \le a_{i} \le b_{i} \le 10^{7}$, $1 \le c_{i} \le d_{i}$ ≤ $10^{7}$).

Output

Output $t$ lines in total. For the $i$-th test case, output DA (Croatian for yes) if $a_{i}$ · ($a_{i} + 1$) · · · $b_{i}$ divides $c_{i}$ · ($c_{i} + 1$) · · · $d_{i}$, and output NE (Croatian for $no$) otherwise.

Constraints

In test cases worth 10 points it holds $a_{i}$, $b_{i}$, $c_{i}$, $d_{i} \le 50$. In test cases worth additional 20 points it holds $a_{i}$, $b_{i}$, $c_{i}$, $d_{i} \le 1000$. In test cases worth additional 10 points it holds $a_{i} = 1$.

Example 1

Input
2
9 10 3 6
2 5 7 9
Output
DA
NE

Example 2

Input
6
1 2 3 4
1 4 2 3
2 3 1 4
1 3 2 4
19 22 55 57
55 57 19 22
Output
DA
NE
DA
DA
DA
DA
Source
COCI 2020/2021 Contest 4
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code