Submission #19102

#TimeUsernameProblemLanguageResultExecution timeMemory
19102NamnamseoBe Two Bees (OJUZ10_b2b)C++14
100 / 100
136 ms1864 KiB
#include <cstdio> int n; int eat[100010]; int make[100010]; int ch1, ch2; typedef long long ll; ll sumeat; bool chk(double x){ int mi=-1, smi=-1; double mv=-1e280, smv=-1e280; for(int i=0;i<n;++i){ double cv=x*1.0/make[i]+eat[i]; if(mv < cv){ smv=mv; smi=mi; mv=cv; mi=i; } else if(smv<cv){ smv=cv; smi=i; } } if(mv+smv >= sumeat){ ch1=mi; ch2=smi; return true; } return false; } int main() { scanf("%d",&n); int i; for(i=0;i<n;++i) scanf("%d",eat+i), sumeat += eat[i]; for(i=0;i<n;++i) scanf("%d",make+i); double l=0, r=1e20, mid; for(i=0;i<100;++i){ (chk(mid=(l+r)/2)?r:l)=mid; } //printf("value %f\n",r); if(ch1>ch2) ch2+=ch1, ch1=ch2-ch1, ch2=ch2-ch1; printf("%d %d\n",ch1+1,ch2+1); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...