| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 4 초 (추가 시간 없음) | 1024 MB | 20 | 14 | 12 | 80.000% |
John is a researcher working in the field of Artificial Intelligence. At the moment he needs to analyze reasoning abilities of a new Limitless Logic Machine, he wants to check how well it can understand when one thing implies another.
The scientist is planning to use a long array $a$ consisting of zeroes and ones for his experiment. During the experiment, he will make multiple queries to the machine, where each query is defined by a pair $l$, $r$. For each query, the machine will be asked to compute the value of the implication of the subarray $a_l \to a_{l + 1} \to \ldots \to a_r$. John asks you, as his AI Application Project Junior Engineer, to compute the correct answers for these queries, so he can use them to validate his machine.
The implication operator is defined as follows:
| $x$ | $y$ | $x \to y$ |
| $0$ | $0$ | $1$ |
| $0$ | $1$ | $1$ |
| $1$ | $0$ | $0$ |
| $1$ | $1$ | $1$ |
In this problem, we assume a left-to-right evaluation order, so the order of the operations is $((\dots((a_l \to a_{l + 1}) \to a_{l + 2}) \to \dots) \to a_r)$.
The input consists of:
For each query, output the result of the corresponding implication.
5 0 0 1 1 0 5 1 2 2 3 4 5 3 4 1 5
1 1 0 1 0
7 1 0 0 0 1 0 0 5 1 3 4 7 2 4 3 6 1 7
1 1 0 0 1
University > Delft University of Technology > Freshmen Programming Contest 2024 I번