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<cstdio>
#include<algorithm>
using namespace std;
long long n,mh,cnt,s,a1,a2;
double mn=1000000000005,t;
bool dom[100005];
struct Data{
long long h,t;
bool operator ()(Data q,Data w){
if(q.t<w.t)return true;
if(q.t==w.t && q.h>w.h)return true;
return false;
}
}r[100005];
int main()
{
int i,j;
scanf("%d",&n);
for(i=0;i<n;s+=r[i++].h)
scanf("%d",&r[i].h);
for(i=0;i<n;i++)
scanf("%d",&r[i].t);
for(i=0;i<n;i++){
for(j=i+1;j<n;j++) {
t=(double)(s-r[i].h-r[j].h)/((double)1/r[i].t+(double)1/r[j].t);
if(t<mn){
mn=t;
a1=i+1;
a2=j+1;
}
}
}
printf("%lld %lld",a1,a2);
}
# | 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... |