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>
#define MAX 100001
int h[MAX];
int t[MAX];
int p[MAX];
int main()
{
int n;
scanf("%d", &n);
long long int sum_h = 0;
int i, j;
for (i = 1; i <= n; i++)
{
scanf("%d", &h[i]);
sum_h += h[i];
}
for (i = 1; i <= n; i++)
scanf("%d", &t[i]);
double m;
long long int sum;
double sec;
double min = 1000000000;
int a_b, b_b;
for (i = 1; i <= n; i++)
{
for (j = i + 1; j <= n; j++)
{
sum = sum_h;
sum -= (h[i] + h[j]);
m = t[i] + t[j];
m /= t[i] * t[j];
sec = sum / m;
if (sec < min)
{
min = sec;
a_b = i;
b_b = j;
}
}
}
printf("%d %d", a_b, b_b);
return 0;
}
# | 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... |