思路:
找到最小的,然后往左往右加。
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[100010];
int main()
{
ll t;
cin>>t;
while(t--)
{
memset(a,0,sizeof(a));
ll n;
cin>>n;
for(ll i = 1; i <= n; i++)
{
cin>>a[i];
}
ll flag = 0,num = 0x7f7f7f7f;
for(ll i = 1; i <= n; i++)
{
if(a[i] <= num)
{
num = a[i];
flag = i;
}
}
printf("%d\n",n-1);
for(ll i = 1;i < flag; i++)
{
printf("%lld %lld %lld %lld\n",i,flag,a[flag]+abs(flag-i),a[flag]);
}
for(ll i = flag+1; i <= n; i++)
{
printf("%lld %lld %lld %lld\n",i,flag,a[flag]+abs(flag-i),a[flag]);
}
}
}