Under construction

Still being built. Things may change

Dormitory Password Recovery

Time limit2sMemory limit1024 MB

Summary
Recover N hidden coefficients of a linear function mod 998244353 using at most N interactive queries, where every argument must be distinct.
Level

Medium6 of 10

Topics
Math, Matrix
Solved
No attempts yet

Problem

This is an interactive problem.

Hanbyeol and Woobin were assigned to the same dormitory room. Woobin did not want to share a room with Hanbyeol, so before Hanbyeol moved in, Woobin installed a password lock on the door. To open the lock, you must find NN integers x1,x2,⋯ ,xNx_1, x_2, \cdots, x_N that satisfy 0≤xi<998 244 3530 \leq x_i < 998\,244\,353. Woobin provides the following function to test your programming skill. You choose NN integers a1,a2,⋯ ,aNa_1, a_2, \cdots, a_N and learn the value f(a1,a2,⋯ ,aN)f(a_1, a_2, \cdots, a_N).

Let M\mathbb{M} be the set of integers from 0 up to, but not including, 998244353. The function f:M×⋯×M→Mf: \mathbb{M} \times \cdots \times \mathbb{M} \rightarrow \mathbb{M} is defined as

f(a1,a2,⋯ ,aN)=(a1x1+a2x2+⋯+aNxN) mod 998 244 353f(a_1, a_2, \cdots, a_N) = (a_1 x_1 + a_2 x_2 + \cdots + a_N x_N) \bmod 998\,244\,353

You may use the function at most NN times. Across all uses, the arguments a1,⋯ ,aNa_1, \cdots, a_N must all be different. That is, if you use the function kk times, all kNkN arguments must be distinct.

Recover the password and surprise Woobin.

Constraints

2≤N≤25002 \leq N \leq 2500

Hint

Your program must flush the output buffer immediately after printing anything. Flush methods by language:

  • C: fflush(stdout)
  • C++: std::cout.flush()
  • Python: sys.stdout.flush()
  • Java: System.out.flush()
  • For other languages, check the documentation of that language.

Examples1

  1. Example 1

    Input
    2
    
    4
    
    6
    
    
    Expected output
    
    ? 1 3
    
    ? 2 4
    
    ! 1 1