Chocolate Bunny SOLUTION
This is a natural issue. We got away from you a phase p of length n, involving the parts from 1 to n. You have to get it. To do that, you can give us 2 unmistakable records I and j, and we will reply with pimodpj (rest of division pi by pj).
We have enough resilience to answer everything thought about 2⋅n requests, so you should fit in this constraint. OK have the option to do it?
As an update, a difference in length n is a group containing n undeniable numbers from 1 to n in self-confident solicitation. For example, [2,3,1,5,4] is a phase, anyway [1,2,2] isn’t a change (2 shows up twice in the display) and [1,3,4] is in like manner not a change (n=3 yet there is 4 in the group).
The principle line of the information contains a singular entire number n (1≤n≤104) — length of the change.
The affiliation starts with getting n.
By then you are allowed to make everything thought about 2⋅n inquiries in the going with way:
“? x y” (1≤x,y≤n,x≠y).
After each one, you ought to scrutinize a number k, that approaches pxmodpy.
Right when you have estimated the stage, print a single line “! ” (without refers to), followed by show p and quit.
In the wake of printing an inquiry make sure to yield end of line and flush the yield. Else, you will get Idleness limit outperformed. To do this, usage:
fflush(stdout) or cout.flush() in C++;
System.out.flush() in Java;
flush(output) in Pascal;
stdout.flush() in Python;
see documentation for various lingos.
Leave following getting “- 1” and you will see Wrong answer choice. Else you can get an optional choice because your answer will continue scrutinizing from a shut stream.
In the essential line yield n (1≤n≤104). In the resulting line print the phase of n numbers p1,p2,… ,pn.
? 1 2
? 3 2
? 1 3
? 2 1
! 1 3 2