DMPG '17 G6 - Vera and Ice Cream Cake
View as PDFThis is an interactive problem. In the interaction section below you will see the information about flushing the output.
Vera is baking an ice cream cake consisting of  flavours of ice cream in the shape of an 
 rectangle. Let 
 denote a flavour where 
. Each flavour has tastiness 
 and no two flavours have the same tastiness. A flavour is more tasty than another if it has higher tastiness.
Two flavours  and 
 are adjacent if and only if 
. Vera thinks a flavour 
 is delicious if it is more tasty than all of its adjacent flavours.
Vera does not know the tastiness of each flavour but she can take a nibble of any two different flavours  and 
 and determine which flavour is more tasty.
Given integer , tell Vera which flavours to nibble and find a delicious flavour. Vera would like to eat her delicious flavour soon so you can only ask her to nibble 
 times. She is sure that you can find a delicious flavour after knowing the result of 
 nibbles.
Constraints
For all subtasks:
 is an integer.
Subtask 1 [25%]
 and 
Subtask 2 [25%]
 and 
Subtask 3 [50%]
 and 
Input Specification
Format:
Output Specification
To print the answer, print one line in the format:
2  
where  is a delicious flavour. Do not forget to flush your answer!
If there are multiple delicious flavours print any of them.
After printing the answer your program must terminate.
Interaction
First you must read . Then you can ask Vera to nibble.
To ask Vera to nibble flavours  and 
 print one line in the format:
1  
 
 
Note, you must flush your output to get a response.
Vera's response will be printed on one line in the format:
If  then flavour 
 is more tasty than flavour 
. Otherwise 
 and flavour 
 is more tasty than flavour 
.
If your nibble request is not in the correct format or you ask for too many nibbles you will get WA.
To flush you can use (just after printing an integer and end-of-line):
fflush(stdout)in C++;System.out.flush()in Java;stdout.flush()in Python;flush(output)in Pascal.
Sample Input
3
0
1
1
0
0
1
1
0
Sample Output
1 1 2 1 1
1 1 3 1 1
1 2 1 1 3
1 2 2 2 1
1 2 3 2 1
1 3 1 2 1
1 3 2 3 1
1 3 3 3 2
2 3 2
Explanation of Sample Output
This is a possible interaction when the cake has the following tastiness:
2 1 3
6 5 4
7 9 8
 nibbles were made and the delicious flavour is 
 with tastiness 
.
Comments