# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
14345 |
2015-05-12T10:20:44 Z |
comet |
Be Two Bees (OJUZ10_b2b) |
C++ |
|
918 ms |
4324 KB |
#include<bits/stdc++.h>
using namespace std;
int n;
double sum,H[111111],T[111111],a[111111];
bool check(double k){
for(int i=0;i<n;i++)a[i]=H[i]+k*T[i];
sort(a,a+n);
double ret=0;
for(int i=0;i<n-2;i++)ret+=a[i];
//printf("%f : %f\n",ret,k*sum);
return ret<=k*sum;
}
void output(double k){
double Max=0;
int v,v2;
for(int i=0;i<n;i++)a[i]=H[i]+k*T[i];
for(int i=0;i<n;i++){
if(Max<a[i]){
Max=a[i];
v=i;
}
}
Max=0;
for(int i=0;i<n;i++){
if(Max<a[i]&&i!=v){
Max=a[i];
v2=i;
}
}
printf("%d %d\n",v+1,v2+1);
}
int main(){
scanf("%d",&n);
int x,y,z;
for(int i=0;i<n;i++)scanf("%lf",&H[i]);
for(int i=0;i<n;i++){
scanf("%lf",&T[i]);
T[i]=(double)1/T[i];
sum+=T[i];
}
double lo=0,hi=1e19,mid;
for(int i=0;i<90;i++){
mid=(lo+hi)/2;
if(check(mid)){
hi=mid;
}
else{
lo=mid;
}
//printf("%f %f\n",lo,hi);
}
output(hi);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
5 |
Correct |
0 ms |
4324 KB |
Output is correct |
6 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4324 KB |
Output is correct |
2 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
3 |
Incorrect |
5 ms |
4324 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
5 |
Incorrect |
4 ms |
4324 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
7 |
Incorrect |
4 ms |
4324 KB |
Output isn't correct |
8 |
Correct |
5 ms |
4324 KB |
Output is correct |
9 |
Incorrect |
0 ms |
4324 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
246 ms |
4324 KB |
Output is correct |
2 |
Correct |
245 ms |
4324 KB |
Output is correct |
3 |
Correct |
404 ms |
4324 KB |
Output is correct |
4 |
Incorrect |
279 ms |
4324 KB |
Output isn't correct |
5 |
Correct |
688 ms |
4324 KB |
Output is correct |
6 |
Incorrect |
913 ms |
4324 KB |
Output isn't correct |
7 |
Incorrect |
499 ms |
4324 KB |
Output isn't correct |
8 |
Incorrect |
903 ms |
4324 KB |
Output isn't correct |
9 |
Correct |
891 ms |
4324 KB |
Output is correct |
10 |
Incorrect |
620 ms |
4324 KB |
Output isn't correct |
11 |
Correct |
848 ms |
4324 KB |
Output is correct |
12 |
Correct |
895 ms |
4324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
918 ms |
4324 KB |
Output isn't correct |
2 |
Correct |
906 ms |
4324 KB |
Output is correct |
3 |
Correct |
918 ms |
4324 KB |
Output is correct |
4 |
Incorrect |
904 ms |
4324 KB |
Output isn't correct |
5 |
Correct |
899 ms |
4324 KB |
Output is correct |
6 |
Incorrect |
909 ms |
4324 KB |
Output isn't correct |
7 |
Incorrect |
512 ms |
4324 KB |
Output isn't correct |
8 |
Correct |
622 ms |
4324 KB |
Output is correct |
9 |
Correct |
901 ms |
4324 KB |
Output is correct |
10 |
Correct |
606 ms |
4324 KB |
Output is correct |
11 |
Incorrect |
913 ms |
4324 KB |
Output isn't correct |
12 |
Correct |
68 ms |
4324 KB |
Output is correct |
13 |
Correct |
896 ms |
4324 KB |
Output is correct |
14 |
Correct |
578 ms |
4324 KB |
Output is correct |
15 |
Correct |
613 ms |
4324 KB |
Output is correct |
16 |
Correct |
900 ms |
4324 KB |
Output is correct |
17 |
Incorrect |
906 ms |
4324 KB |
Output isn't correct |