Submission #14168

#TimeUsernameProblemLanguageResultExecution timeMemory
14168pichuliaBe Two Bees (OJUZ10_b2b)C++98
0 / 100
6 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("2 7\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; int mi,mj; mi=mj=-1; for(i=0;i<n;i++) for(j=i+1;j<n;j++) { if(mi==-1) { p = (x-a[i]-a[j])*b[i]*b[j]; q = b[i]+b[j]; mi = i; mj = j; } else { if(p *(b[i]+b[j]) > q*(x-a[i]-a[j])*b[i]*b[j] ) { p = (x-a[i]-a[j])*b[i]*b[j]; q = (b[i]+b[j]); 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...