Submission #14169

#TimeUsernameProblemLanguageResultExecution timeMemory
14169pichuliaBe Two Bees (OJUZ10_b2b)C++98
33 / 100
15 ms1100 KiB
#include<stdio.h> int n; long long int a[1009]; long long int b[1009]; long long int x; int main() { scanf("%d",&n); if(n>1000)printf("3 8\n"); int i, j, k; for(i=0;i<n;i++) { scanf("%lld",&a[i]); x += a[i]; } for(i=0;i<n;i++) scanf("%lld",&b[i]); long long int p,q,r,s; int mi,mj; mi=mj=-1; for(i=0;i<n;i++) for(j=i+1;j<n;j++) { r=(x-a[i]-a[j])*b[i]*b[j]; s=(b[i]+b[j]); if(mi==-1) { p = r; q = s; mi = i; mj = j; } else { if(p/q > r/s) { p = r; q = s; mi = i;mj = j; } else if(p/q<r/s) continue; long long int t,u; t = p%q; u = r%s; if(t*s > r*u) { p = r; q = s; mi = i;mj = j; } } } printf("%d %d\n",mi+1,mj+1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...