arbitrary choices that are made during the title are made similarly plausible and autonomously.    For instance, assuming n=4, a=[1,2,4,3], one of the choices for the game (there could be different choices) is:    during the main game, the first and fourth players were chosen. The fourth player has more

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 12RP
icon
Related questions
Question

Correct answer will be upvoted else downvoted. Computer science.

 

 All arbitrary choices that are made during the title are made similarly plausible and autonomously. 

 

For instance, assuming n=4, a=[1,2,4,3], one of the choices for the game (there could be different choices) is: 

 

during the main game, the first and fourth players were chosen. The fourth player has more tokens, so he takes the main player's tokens. Presently a=[0,2,4,4]; 

 

during the subsequent game, the fourth and third players were chosen. They have similar number of tokens, yet arbitrarily, the third player is the champ. Presently a=[0,2,8,0]; 

 

during the third game, the second and third players were chosen. The third player has more tokens, so he requires the second player's tokens. Presently a=[0,0,10,0]; 

 

the third player is proclaimed the victor of the title. 

 

Title champs will get customized prizes. Consequently, the adjudicators need to know ahead of time which players get an opportunity of winning, i.e have a non-no likelihood of winning the title. You have been approached to track down every such player. 

 

Input 

 

The main line contains one integer t (1≤t≤104) — the number of experiments. Then, at that point, t experiments follow. 

 

The primary line of each experiment comprises of one sure integer n (1≤n≤2⋅105) — the number of players in the title. 

 

The second line of each experiment contains n positive integers a1,a2,… ,an (1≤ai≤109) — the number of tokens the players have. 

 

It is ensured that the amount of n over all experiments doesn't surpass 2⋅105. 

 

Output 

 

For each experiment, print the number of players who have a nonzero likelihood of winning the title. On the following line print the numbers of these players in expanding request. Players are numbered beginning from one as per the pattern in which where they show up in the input.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole