#P14257. 嫉妒(jealousy)

    ID: 13451 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 1 上传者: 标签>模拟数学2025洛谷原创O2优化枚举洛谷月赛

嫉妒(jealousy)

Description

Little S is going to interview at the bookstore where Little Y works part-time, but she wants to keep it a secret for now.

There are a total of nn interviews. The first interview starts when the bookstore opens, and each interview lasts for ss minutes, with the next one immediately following the previous one. Specifically, let the bookstore opening time be minute 00. The ii-th interview takes place from minute (i1)×s(i-1)\times s to minute i×si\times s.

Little Y arrives at the bookstore to work at minute yy. He starts from the interview room door, inspects around the bookshelves, and returns to the interview room door every tt minutes. Specifically, he will be at the interview room door at minute y+j×ty+j\times t, where jj is a non-negative integer.

If Little Y is exactly at the interview room door when Little S's interview starts or ends, she will be discovered. Little S wants to know whether there exists at least one interview among the nn interviews that she can attend without being discovered. In other words, whether there exists a positive integer ii satisfying 1in1\le i\le n, and there is no non-negative integer jj such that (i1)×s=y+j×t(i-1)\times s=y+j\times t or i×s=y+j×ti\times s=y+j\times t.

Input Format

Input a single line containing four integers n,y,s,tn, y, s, t, representing the number of interviews, the start time of Little Y's work, the duration of one interview, and the time it takes to complete one round of inspection, respectively.

Output Format

Output a string on a single line: if there is an interview that Little S can attend without being discovered, output Yes; otherwise, output No.

2 0 2 5

Yes

1 0 1 9

No

Hint

【Sample 1 Explanation】

Little Y is at the interview room door at minutes 0,5,10,0, 5, 10, \dots.

The first interview lasts from minute 00 to minute 22, and would be discovered at minute 00; the second interview lasts from minute 22 to minute 44. If Little S attends this one, she will not be discovered, so output Yes.

【Sample 2 Explanation】

Little Y is at the interview room door at minutes 0,9,18,0, 9, 18, \dots.

The only interview Little S can attend lasts from minute 00 to minute 11, and would be discovered at minute 00, so output No.

【Sample 3】

See jealousy3.in and jealousy3.ans in the problem attachment.

This sample satisfies special properties AB.

【Sample 4】

See jealousy4.in and jealousy4.ans in the problem attachment.

This sample satisfies special properties BC.

【Data Range】

For all test data, it is guaranteed that: 1n101 \le n \le 10, 0y300 \le y \le 30, 1s,t301 \le s, t \le 30.

::cute-table{tuack}

Test Data ID nn \le Special Properties
11 A
232\sim3 1010 B
44 ^ AB
565\sim6 C
7107\sim10 None

Special Property A: It is guaranteed that y=0y = 0.

Special Property B: It is guaranteed that t(2×s)t \mid (2 \times s).

Special Property C: It is guaranteed that s<ys < y.

Here, aba \mid b denotes that aa divides bb, meaning there exists an integer cc such that a×c=ba \times c = b.