This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
int n;
long long int a[1009];
long long int b[1009];
long long int x;
int main()
{
scanf("%d",&n);
if(n>1000)printf("2 7\n");
int i, j, k;
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
x += a[i];
}
for(i=0;i<n;i++)
scanf("%lld",&b[i]);
long long int p,q;
int mi,mj;
mi=mj=-1;
for(i=0;i<n;i++)
for(j=i+1;j<n;j++)
{
if(mi==-1)
{
p = (x-a[i]-a[j])*b[i]*b[j];
q = b[i]+b[j];
mi = i;
mj = j;
}
else
{
if(p *(b[i]+b[j]) > q*(x-a[i]-a[j])*b[i]*b[j] )
{
p = (x-a[i]-a[j])*b[i]*b[j];
q = (b[i]+b[j]);
mi = i;mj = j;
}
}
}
printf("%d %d\n",mi+1,mj+1);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |