SnowflakeOA #46
Simple Array Rotation Game
估计简单可在线判题
考点(AI 标注)原地数组
The array consists of distinct positive integers. Each query independently rotates the original array to the left r times and returns the new 0-based index of the maximum element; rotations do not accumulate across queries.
输入格式
The first line contains n m, the second line contains n distinct array values, and the third line contains m rotation counts. 1≤n,m≤500000, 1≤array value≤10⁹, 0≤rotation count≤10⁹.
输出格式
First output m, then output m 0-based indices of the maximum element.
样例 1
输入:
3 3
1 2 3
1 2 3
输出:
3
1 0 2
样例 2
输入:
3 3
9 1 2
0 1 4
输出:
3
0 2 2
样例 3
输入:
1 2
7
0 1000000000
输出:
2
0 0
样例说明
The answers to the three public examples are, in order: 3 1 0 2; 3 0 2 2; 2 0 0. The examples were checked by independent enumeration, state search, or direct simulation.