| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 1024 MB | 24 | 19 | 15 | 75.000% |
You are building a boolean circuit and need to compute the logical AND of a collection of source signals. The problem is that you only have access to a collection of identical AND gates that take two boolean inputs (i.e. True or False) and outputs a single boolean value that is True if and only if both inputs were True.
Recalling your digital design course, you remember you can connect some of these AND gates together (by connecting the outputs of some to the inputs of others) to build a circuit that has one input for each source signal you need to consider and a single output that is True if and only if every source signal is True. More precisely, you should build a circuit satisfying the following properties.
AND gates in the circuit where $N$ is the number of source signals.AND gate.AND gate in the circuit is connected to precisely one signal, which will either be one of the source signals or will be the output signal of another AND gate.AND gate will never reach one of its own input wires.Finally, the output of your circuit will be connected to an LED which will be used to indicate if this signal is True or False. So the LED will illuminate if and only if all source signals are True.
You want to do this in a way that minimizes the worst-case delay for the output signal to change if the source of one of the input signals changes. You know the following:
AND gate, after an input signal changes it takes exactly $D$ nanoseconds for the output signal to change (if the new inputs would cause the output to change).AND gates to another component of the circuit is negligible and will be regarded as 0ドル$ nanoseconds.Help design a circuit to minimize the maximum time between when one of the sources signal changes to when the LED changes (if indeed the new input would cause the LED to change).
Figure 1: Illustration of an optimal circuit for each of the sample inputs. The numbers on the left indicate the index of the source signal.
The first line of input contains three integers $N$ (2ドル \leq N \leq 4 \cdot 10^5$), $D$ and $L$ (1ドル \leq D,L \leq 10^9$) where $N$ is the number of source signals and $D,L$ are as in the problem description. The second line contains $N$ integers $n_1, n_2, \ldots n_N$ (1ドル \leq n_i \leq 10^9$) where $n_i$ indicates the number of nanoseconds it takes for a change source $i$'s signal to reach your circuit.
Output the smallest time $T$ such that it is possible to build a circuit ensuring it takes at most $T$ nanoseconds for the LED to change if one of the source's signal changes in a way that would cause the LED to change.
3 3 5 3 8 1
16
5 5 10 5 8 3 3 3
28
ICPC > Regionals > North America > North Central North America Regional > 2024 North Central NA Regional Contest C번
ICPC > Regionals > North America > Rocky Mountain Regional > 2024 Rocky Mountain Regional Contest C번
ICPC > Regionals > North America > Mid-Central Regional > 2024 Mid-Central USA Programming Contest C번