Submission #14212

#TimeUsernameProblemLanguageResultExecution timeMemory
14212khsoo01Be Two Bees (OJUZ10_b2b)C++98
0 / 100
1000 ms6552 KiB
#include<cstdio> #include<algorithm> using namespace std; long long n,mh,cnt,s,a1,a2,c[100005]; double mn=10000000000000000000,t; struct Data{ long long h,t,idx; bool operator ()(Data q,Data w){ if(q.h>w.h)return true; return false; } }d[100005],r[100005]; int main() { int i,j; scanf("%d",&n); for(i=0;i<n;s+=d[i++].h) scanf("%d",&d[i].h); for(i=0;i<n;d[i++].idx=i) scanf("%d",&d[i].t); sort(d,d+n,Data()); for(i=0;i<n;i++) { if(c[d[i].h]<2){ c[d[i].h]++; r[cnt++]=d[i]; } } for(i=0;i<cnt;i++){ for(j=i+1;j<cnt;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=r[i].idx+1; a2=r[j].idx+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...