4580: D
题目描述
最近,Jvruo痴迷于一款格斗游戏。在这个游戏中,n个角色从左到右站在一个竞技场上,第i个角色的战斗力是ai。对于每个操作,Jvruo将在竞技场上选择两个相邻的角色x和y进行决斗。如果 ax > ay,则 x 获胜,如果ax < ay,则y 获胜。如果ax = ay,则 x 和y 都有 50% 的获胜概率。胜利的角色将留在竞技场中,战斗力加倍;失败的角色将离开竞技场。
现在Jvruo将执行n-1个操作,经过n-1个操作后,戒指中将只剩下一个字符。显然,Jvruo 有 (n − 1)!操作模式。在所有这些操作模式中,哪些角色有概率坚持到最后并成为最终的赢家。
输入格式
The first line contains a positive integer n(1 ≤ n ≤ 5∗10e5), which represents the number of the characters.
The second line contains n integers separated by spaces ai(1 ≤ ai ≤ 10e9), which represents the the combat power of the ith character.
输出格式
The first line contains a positive integer m, which represents the number of the characters who have the probability to stay till the end and become the final winner.
The second line contains m integers in ascending order separated by spaces bi(b1 < b2 < …… < bm), which represents the the index of the characters who have the probability to stay till the end and become the final winner
输入样例 复制
5
1 2 30 16 1
输出样例 复制
2
3 4