PivotOJ

Gyrating Glyphs

시간 제한: 6000ms메모리 제한: 1024MB출처: BAPC 2021BOJ 23381

문제

You are rocking the latest breakthrough in Computer Science: animated fonts. Suddenly, all of your colleagues' code looks amazing, and you are finally motivated to review it. Unfortunately, due to the constant rotations, it is hard to distinguish between the ++ (plus) and the ×\times (multiply) operators (all the other characters are still readable). The function you are reviewing takes as input n+1n+1 integers a0,a1,,ana_0, a_1, \ldots, a_n and returns the value ((((a0op1a1)op2a2)op3a3)opnan)109+7,\bigg(\ldots\Big(\big((a_0 \,\operatorname{op}_1\, a_1) \,\operatorname{op}_2\, a_2\big) \,\operatorname{op}_3\, a_3\Big) \ldots \,\operatorname{op}_n\, a_n\bigg)\quad \bmod 10^9+7, where the nn operators op1,op2,,opn\operatorname{op}_1,\, \operatorname{op}_2,\, \ldots,\, \operatorname{op}_n are either ++ or ×\times. For example when given input (a0,a1,a2)=(1,1,2)(a_0,a_1,a_2) = (1,1,2) with hidden operators (op1,op2)=(+,×)(\operatorname{op}_1,\operatorname{op}_2)=(+,\times), then the function returns ((1+1)×2)=4109+7((1+1)\times2)=4 \bmod 10^9+7.

You can still execute the function a few times on some input and read the returned value. Use this to recover the operators.

예제

예제 1

입력
2

4

6
출력
? 1 1 2

? 1 1 3

! +x

예제 2

입력
10

5

6224

640750
출력
? 1 1 1 1 1 1 1 1 1 1 1

? 0 4 2 4 2 4 2 4 2 4 2

? 1 2 3 4 5 6 7 8 9 10 11

! ++xxx+x+xx
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.