## Inaho X

View as PDF

Points: 7 (partial)
Time limit: 3.0s
Memory limit: 64M

Author:
Problem type

Inaho is given an array of length , such that is a unique integer. With the array, he defines a function:

Inaho wants to play a game with you! He wants you to recreate the array. Because he knows this is impossible, he will allow you to ask him some questions. In particular, you are to ask him , where , and he will reply with . He wants this to be challenging. As such, he will only allow you to ask him questions.

Tell Inaho what his array is!

#### Input Specification

Inaho will provide you the integer on the first line.

#### Interaction

You may then ask questions. To ask a question, you must use the form Q x. Note that is in radians and must be in the range . may contain as many decimal places as you desire, however, will be rounded to decimal places. Inaho's response is guaranteed to be precise to decimal places.

To tell Inaho the array , you must use the form A p. is an integer, such that the bit in is if there exists a , and otherwise. Because is guaranteed to be unique, this means the number of bits in should be equal to . For example, if , and , then .

You are allowed to ask Inaho a maximum of questions. Note that telling Inaho the array does not count as a question.

After each question or the answer, you may need to flush stdout. You do not need to flush if you are using C++, Java, or Python 2/3. In other languages, such as Pascal, you will need to flush stdout for the interactor to receive your output.

Note 1: Up to seconds of the time limit could be used up by the interactor.

#### Output Specification

To tell Inaho the array , use the form A p, where is the integer as defined in the Interaction section.

#### Subtasks

##### Subtask 3 [60%]

Note that these are not explicit subtasks. You will receive the specified percentage of points depending on which subtask you fall in. For example, using questions for will grant you of the points.

#### Sample Interaction

>>> denotes your output; don't actually print this out.

3
>>> Q 0.000000000000
0.000000000000000
>>> Q 3.01
-1.239969287666227
>>> A 13

## Comments

• Zeyu  commented on Jan. 13, 2019, 5:45 p.m.

Stuck from getting IR with python 2/3 but I can't seem to reproduce the issue on multiple different environments, can someone help guide me in the right direction?

• Kirito  commented on Jan. 13, 2019, 6:51 p.m.

Do you flush your output?

• Zeyu  commented on Jan. 13, 2019, 7:58 p.m. edited

Same IR response after flushing for every interaction unfortunately, that didn't seem to be the case.

EDIT: Apparently flushing before an interaction is also needed? That seemed to cure the IR response.