play out the activity: select two diverse lists i,j (1≤i,j≤n, i≠j) and two integers x,y (1≤x,y≤2⋅109) so that min(ai,aj)=min(x,y). Then, at that point, change computer based intelligence to x and aj to y.    The young lady requests that you make the exhibit great utilizing all things considered n activities.    It tends to be demonstrated that this is consistently conceivable

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.3: How To Maximize The Probability Of A Favorable Event Occurring
Problem 1P
icon
Related questions
Question

Correct answer will be upvoted else downvoted.

 

You can play out the activity: select two diverse lists i,j (1≤i,j≤n, i≠j) and two integers x,y (1≤x,y≤2⋅109) so that min(ai,aj)=min(x,y). Then, at that point, change computer based intelligence to x and aj to y. 

 

The young lady requests that you make the exhibit great utilizing all things considered n activities. 

 

It tends to be demonstrated that this is consistently conceivable. 

 

Input 

 

The main line contains a solitary integer t (1≤t≤10000) — the number of experiments. 

 

The main line of each experiment contains a solitary integer n (1≤n≤105) — the length of the exhibit. 

 

The second line of each experiment contains n integers a1,a2,… ,an (1≤ai≤109) — the exhibit which Nastia has gotten as a gift. 

 

It's dependable that the amount of n in one test doesn't surpass 2⋅105. 

 

Output 

 

For every one of t experiments print a solitary integer k (0≤k≤n) — the number of tasks. You don't have to limit this number. 

 

In every one of the following k lines print 4 integers I, j, x, y (1≤i≠j≤n, 1≤x,y≤2⋅109) so that min(ai,aj)=min(x,y) — as such you supplant artificial intelligence with x and aj with y. 

 

In case there are numerous replies, print any.

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Intelligent Machines
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