Submission #14209

#TimeUsernameProblemLanguageResultExecution timeMemory
14209khsoo01Be Two Bees (OJUZ10_b2b)C++98
11 / 100
1000 ms2744 KiB
#include<cstdio> #include<algorithm> using namespace std; long long n,mh,cnt,s,a1,a2; double mn=987654321,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=s-r[i].h-r[j].h; if(t<mn*((double)1/r[i].t+(double)1/r[j].t)){ mn=t/((double)1/r[i].t+(double)1/r[j].t); a1=i+1; a2=j+1; } } } printf("%lld %lld",a1,a2); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...