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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education