#include<bits/stdc++.h>
using namespace std;
#define maxx 200001
double ara[maxx],prefix_sum[maxx],prefix_multiplication[maxx];
double get(int l,int r)
{
return (prefix_multiplication[r]/prefix_multiplication[l-1]-(prefix_sum[r]-prefix_sum[l-1]));
}
main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
prefix_multiplication[0]=1;
for(int i=1;i<=n;i++)
{
scanf("%lf",&ara[i]);
prefix_sum[i]=prefix_sum[i-1]+ara[i];
prefix_multiplication[i]=prefix_multiplication[i-1]*ara[i];
}
vector<int> v;
for(int i=1;i<=n;i++)
{
if(ara[i]>1)
{
v.push_back(i);
}
}
if(v.size()>40)
{
printf("%d %d\n",v[0],v.back());
}
else
{
int l=1,r=1;
for(int i:v)
{
for(int k:v)
{
if(i<=k)
{
if(get(i,k)>get(l,r))
{
l=i;
r=k;
}
}
}
}
printf("%d %d\n",l,r);
}
}
return 0;
}
1452A - Robot Program | 344A - Magnets |
96A - Football | 702B - Powers of Two |
1036A - Function Height | 443A - Anton and Letters |
1478B - Nezzar and Lucky Number | 228A - Is your horseshoe on the other hoof |
122A - Lucky Division | 1611C - Polycarp Recovers the Permutation |
432A - Choosing Teams | 758A - Holiday Of Equality |
1650C - Weight of the System of Nested Segments | 1097A - Gennady and a Card Game |
248A - Cupboards | 1641A - Great Sequence |
1537A - Arithmetic Array | 1370A - Maximum GCD |
149A - Business trip | 34A - Reconnaissance 2 |
59A - Word | 462B - Appleman and Card Game |
1560C - Infinity Table | 1605C - Dominant Character |
1399A - Remove Smallest | 208A - Dubstep |
1581A - CQXYM Count Permutations | 337A - Puzzles |
495A - Digital Counter | 796A - Buying A House |