| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 76 | 11 | 9 | 15.000% |
JOI Island consists of $L$ districts, numbered from 1ドル$ to $L$ from west to east. There are $L -1$ roads in the island, numbered from 1ドル$ to $L - 1$. Road $i$ (1ドル ≤ i ≤ L - 1$) connects districts $i$ and $i + 1$ bidirectionally.
Now, the International Olympiad in Informatics (IOI 20XX) is planned to be held in JOI Island! The concern is that the island is famous for its extreme heat. There is a high risk of heat stroke, especially for foreign contestants who are not acclimatized to hot environment. So the organizers of IOI decided to take the following measures:
Since the usage of helicopter is costly, the organizers want to estimate the maximum number of patients to be sent by helicopter. They consider the following scenario as an example:
Write a program which, given the number of districts and the information of hospitals and heat stroke patients, computes the maximum number of patients to be sent by helicopter in the scenario above.
Read the following data from the standard input.
$L$
$C_1$ $C_2$ $\cdots$ $C_L$
$N$
$X_1$ $X_2$ $\cdots$ $X_N$
Write one line to the standard output. The output should contain the maximum number of patients to be sent by helicopter.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 6 | $X_1 ≤ X_2 ≤ \cdots ≤ X_N$. |
| 2 | 7 | $L ≤ 18,ドル $N ≤ 18,ドル $C_i = 1$ (1ドル ≤ i ≤ L$). |
| 3 | 7 | $L ≤ 18,ドル $N ≤ 100,ドル $C_i = 1$ (1ドル ≤ i ≤ L$). |
| 4 | 25 | $L ≤ 100,ドル $N ≤ 100,ドル $C_i = 1$ (1ドル ≤ i ≤ L$). |
| 5 | 25 | $L ≤ 100,ドル $N ≤ 100$. |
| 6 | 10 | $L ≤ 600,ドル $N ≤ 600$. |
| 7 | 15 | $L ≤ 3,円 500,ドル $N ≤ 3,円 500$. |
| 8 | 5 | No additional constraints. |
3 1 1 1 3 1 2 2
1
If the following case happens, 1ドル$ patient will be sent by helicopter.
Since there are no cases that 2ドル$ or more patients will be sent by helicopter, output 1ドル$.
This sample input satisfies the constraints of Subtasks 1, 2, 3, 4, 5, 6, 7, 8.
6 1 1 1 1 1 1 7 1 3 5 4 2 2 3
3
If the following case happens, 3ドル$ patient will be sent by helicopter.
Since there are no cases that 4ドル$ or more patients will be sent by helicopter, output 3ドル$.
This sample input satisfies the constraints of Subtasks 2, 3, 4, 5, 6, 7, 8.
6 4000 1 1 0 4000 1 5 1 1 2 3 5
1
This sample input satisfies the constraints of Subtasks 1, 5, 6, 7, 8.
5 1 2 2 2 1 8 2 3 2 1 4 1 2 3
2
This sample input satisfies the constraints of Subtasks 5, 6, 7, 8.
10 2 2 2 2 2 2 2 2 2 2 18 1 3 5 7 9 2 4 6 8 1 3 5 7 9 2 4 6 8
3
This sample input satisfies the constraints of Subtasks 5, 6, 7, 8.