#P10626. [JOI Open 2024] 考试 2 / Examination 2
[JOI Open 2024] 考试 2 / Examination 2
Problem Description
JOI-kun studies at IOI High School, and the final exams are coming soon. The exam topic is computing the IOI function. An IOI function maps integers in to boolean values (i.e., ). An IOI function can be constructed using the following six rules specified by IOI High School:
-
Let be an integer in . Then is an IOI function. It maps integers not less than to , and integers less than to .
-
Let be an IOI function. Then is an IOI function, and its mapping rule is the same as that of .
-
Let be an IOI function. Then is an IOI function. Let be an integer. If maps to , then maps to ; otherwise, maps to .
-
Let be IOI functions. Then is also an IOI function. Let be an integer. Then maps to if and only if both and map to .
-
Let be IOI functions. Then is also an IOI function. Let be an integer. Then maps to if and only if exactly one of and maps to .
-
Let be IOI functions. Then is also an IOI function. Let be an integer. Then maps to if and only if at least one of and maps to .
If an IOI function can be constructed by multiple rules, the rule with the larger number determines the function value. For example, for , you should apply rule 6, where and (instead of applying rule 4, where and ). In addition, for rules 4, 5, and 6, you should maximize the length of . For example, for , you should apply rule 5 with and (instead of and ).
To prepare for the final exams, JOI-kun has prepared an IOI function of length . He plans to practice his computation skills using integers . So he asked you, who can skillfully handle IOI functions, to solve this problem.
You need to write a program. Given and , for , answer whether the IOI function maps to or .
Input Format
The input format is as follows:
Output Format
Output lines. The -th line should be or , which is the value that maps to.
15 5
(![2]|[3])&![4]
1
2
3
4
5
True
False
True
False
False
20 4
(!![23])^((([116])))
54
1
200
89
True
False
False
True
32 4
[2]|[5]&[1]|(([1000000000])|[7])
4
10
6
1
True
True
True
False
Hint
Sample Explanation
The explanation for sample is as follows:
Sample satisfies the conditions of subtasks .
Sample satisfies the conditions of subtasks .
Sample satisfies the conditions of subtasks .
Constraints
- .
- .
- is an IOI function of length .
- ().
- , , and () are all integers.
Subtasks
- ( points) does not contain or .
- ( points) .
- ( points) .
- ( points) does not contain or .
- ( points) When applying rule 4 or 6 to construct , at least one of and is obtained by rule 1.
- ( points) .
- ( points) No additional constraints.
*Contest announcement: If you copy the LaTeX in the statement, you might get ˆ, but it is actually ^. Please pay special attention.
Translated from the English statement by Starrykiller.
Translated by ChatGPT 5