QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 128 MB Total points: 100

#12298. Telescope

Statistics

Byteasar is going to watch a meteor shower tonight. He has read an exact prognosis of its route. He knows that the shower will be composed of n meteors and the i-th meteor will appear at $t_{i}$-th second after midnight, i.e., it will be visible between moments $t_{i} - 1$ and $t_{i}$. For each meteor, Byteasar is only interested in watching it the whole time it is visible.

Byteasar will watch the sky from a nearby hill. He is not going to do it with a naked eye. On the hill there is a telescope which perfectly suits an amateur's needs. However, it is not for free. The telescope accepts coins. For each c inserted bythalers it allows to watch the sky for exactly c seconds. Unfortunately the telescope is a bit shabby, so after an insertion of a coin one must wait for r seconds before anything is visible. Every time only a single coin is accepted. Thus, if you insert a c coin, the next coin will be accepted only after at least $r + c$ seconds.

Byteasar has m coins in his pocket with the values of $c_{1}, \ldots, c_{m}$ bythalers. He is going to use them to pay for the telescope. He wonders what is the maximum number of meteors he can observe with the telescope.

Input Format

The first line of the input contains three integers $n$, $m$ and $r$ ($1 ≤ n ≤ 100$, $1 ≤ m ≤ 10$, $1 ≤ r ≤ 10^{8}$). The second line is composed of $n$ integers $t_{1}, \ldots, t_{n}$ given in the increasing order ($1 ≤ t_{i} ≤ 10^{8}$). The third line contains m integers $c_{1},\ldots, c_{m}$ ($1 ≤ c_{i} ≤ 10^{8}$).

Output Format

The only line of the output should contain one integer, i.e., the maximum number of meteors that Byteasar can observe with the telescope.

Example

Input

7 3 2
1 3 6 7 8 12 13
2 5 1

Output

6

In the figure above black rectangles show seconds during which a meteor is visible. If Byteasar wants to see 6 meteors, he should insert his coins in moments -2, 2 and 9 in the following order of values: 1, 5 and 2 bythalers.

problem_12298_1.gif

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.