#P12078. [OOI 2025] Best Runner
[OOI 2025] Best Runner
题目描述
There are running tracks in the stadium with lengths , , , . There are also runners, with the -th runner starting at the beginning of track .
All runners will train for seconds. The training of a runner proceeds as follows:
Let the runner currently be at the beginning of track . They will run to the end of the current track in seconds. After that, they can either instantly return to the beginning of the current track, or move to the beginning of track (if ), or to the beginning of track (if ). After this, they continue running from the track they moved to. Once the training duration reaches seconds, they finish their training.
We define the best runner as the one who runs the most number of tracks during the training time (there may be several such runners). Determine how many tracks the best runner will run.
输入格式
The first line contains three integers , , and (, ) --- the number of tracks, the number of runners, and the duration of the training.
The second line contains integers , , , () --- the lengths of the tracks.
The third line contains integers , , , () --- the track numbers from which the runners start.
输出格式
Output a single integer --- the maximum number of full tracks that one of the runners can run during the training time.
5 3 10
4 5 2 7 1
1 2 4
4
4 2 11
4 5 7 10
2 3
2
提示
Note
In the first example, the runner starting on track can run the most tracks: they should run track , then move to track and run it times.
In the second example, the runner starting on track can run the second track times.
Scoring
The tests for this problem consist of six groups. Points for each group are given only if all tests of the group and all tests of the required groups are passed.
| Group | Points | Additional constraints: | Required Groups | Comment | ||
|---|---|---|---|---|---|---|
| 0 | -- | -- | -- | -- | Examples. | |
| 1 | 23 | 0 | ||||
| 2 | 10 | -- | -- | for all | ||
| 3 | 16 | 0 | ||||
| 4 | 19 | -- | ||||
| 5 | 11 | -- | -- | |||
| 6 | 21 | 0 -- 5 | ||||