C.Nastia and a Hidden Permutation
题目:
This is an interactive problem!
Nastia has a hidden permutation p of length n consisting of integers from 1 to n n n. You, for some reason, want to figure out the permutation. To do that, you can give her an integer t ( 1 ≤ t ≤ 2 ) t( 1\le t\le 2) t(1≤t≤2), two different indices i i i and j ( 1 ≤ i , j ≤ n , i ≠ j ) j(1\le i,j\le n,i\ne j) j(1≤i,j≤n,i=j), and an integer x ( 1 ≤ x ≤ n − 1 ) x(1\le x\le n-1) x(1≤x≤n−1)
Depending on t t t, she will answer:
t = 1 : m a x ( m i n ( x , p i ) , m i n ( x + 1 , p j ) ) t = 2 : m i n ( m a x ( x , p i ) , m a x ( x + 1 , p j ) ) t=1:max(min(x,p_i),min(x+1,p_j))\\t=2:min(max(x,p_i),max(x+1,p_j)) t=1:max(min(x,pi),min(x+1,pj))t=2:min(max(x,pi),max(x+1,pj))
You can ask Nastia at most ⌊3⋅n/2⌋+30 times. It is guaranteed that she will not change her permutation depending on your queries. Can you guess the permutation?
题意:
交互题:给一个1到 n n n的序列,通过最多 ⌊ 3 ∗ n 2 ⌋ + 30 − n + 1 \lfloor \frac{3*n}{2} \rfloor+30-n+1 ⌊23∗n⌋+30−n+1次操作,最终猜出这 n n n个数分别是什么。
对于每次操作需给出操作方法序号,猜测值 x x x,以及猜测数下标 i , j i,j i,j。
①返回 m a x ( m i n ( x , p i ) , m i n ( x + 1 , p j ) ) max(min(x,p_i),min(x+1,p_j)) max(min(x,