# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
14352 |
2015-05-12T10:56:43 Z |
comet |
Be Two Bees (OJUZ10_b2b) |
C++ |
|
167 ms |
3456 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll sum;
int H[111111],T[111111];
double a[111111];
bool check(double k){
for(int i=0;i<n;i++)a[i]=H[i]+k/T[i];
double ret=0;
double* t=max_element(a,a+n);
ret+=*t;
*t=-1e18;
t=max_element(a,a+n);
ret+=*t;
return ret>sum;
}
void output(double k){
for(int i=0;i<n;i++)a[i]=H[i]+k/T[i];
int v,v2;
double* t=max_element(a,a+n);
v=t-a+1;
*t=-1e18;
t=max_element(a,a+n);
v2=t-a+1;
printf("%d %d",min(v,v2),max(v,v2));
}
int main(){
scanf("%d",&n);
int x,y,z;
for(int i=0;i<n;i++){
scanf("%d",&H[i]);
sum+=H[i];
}
for(int i=0;i<n;i++){
scanf("%d",&T[i]);
}
double lo=0,hi=1e15,mid;
for(int i=0;i<100;i++){
mid=(lo+hi)/2;
if(check(mid)){
hi=mid;
}
else{
lo=mid;
}
//printf("%f %f\n",hi,lo);
}
output(hi);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3456 KB |
Output is correct |
2 |
Correct |
0 ms |
3456 KB |
Output is correct |
3 |
Correct |
0 ms |
3456 KB |
Output is correct |
4 |
Correct |
0 ms |
3456 KB |
Output is correct |
5 |
Correct |
0 ms |
3456 KB |
Output is correct |
6 |
Correct |
0 ms |
3456 KB |
Output is correct |
7 |
Correct |
0 ms |
3456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3456 KB |
Output is correct |
2 |
Correct |
2 ms |
3456 KB |
Output is correct |
3 |
Correct |
0 ms |
3456 KB |
Output is correct |
4 |
Correct |
2 ms |
3456 KB |
Output is correct |
5 |
Correct |
0 ms |
3456 KB |
Output is correct |
6 |
Correct |
0 ms |
3456 KB |
Output is correct |
7 |
Correct |
2 ms |
3456 KB |
Output is correct |
8 |
Correct |
0 ms |
3456 KB |
Output is correct |
9 |
Correct |
0 ms |
3456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
145 ms |
3456 KB |
Output is correct |
2 |
Correct |
162 ms |
3456 KB |
Output is correct |
3 |
Correct |
157 ms |
3456 KB |
Output is correct |
4 |
Correct |
158 ms |
3456 KB |
Output is correct |
5 |
Correct |
111 ms |
3456 KB |
Output is correct |
6 |
Correct |
158 ms |
3456 KB |
Output is correct |
7 |
Correct |
92 ms |
3456 KB |
Output is correct |
8 |
Correct |
159 ms |
3456 KB |
Output is correct |
9 |
Correct |
98 ms |
3456 KB |
Output is correct |
10 |
Correct |
158 ms |
3456 KB |
Output is correct |
11 |
Correct |
55 ms |
3456 KB |
Output is correct |
12 |
Correct |
79 ms |
3456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
167 ms |
3456 KB |
Output is correct |
2 |
Correct |
166 ms |
3456 KB |
Output is correct |
3 |
Correct |
167 ms |
3456 KB |
Output is correct |
4 |
Correct |
54 ms |
3456 KB |
Output is correct |
5 |
Correct |
166 ms |
3456 KB |
Output is correct |
6 |
Correct |
161 ms |
3456 KB |
Output is correct |
7 |
Correct |
113 ms |
3456 KB |
Output is correct |
8 |
Correct |
92 ms |
3456 KB |
Output is correct |
9 |
Correct |
166 ms |
3456 KB |
Output is correct |
10 |
Correct |
106 ms |
3456 KB |
Output is correct |
11 |
Correct |
150 ms |
3456 KB |
Output is correct |
12 |
Correct |
163 ms |
3456 KB |
Output is correct |
13 |
Correct |
155 ms |
3456 KB |
Output is correct |
14 |
Correct |
161 ms |
3456 KB |
Output is correct |
15 |
Correct |
160 ms |
3456 KB |
Output is correct |
16 |
Correct |
165 ms |
3456 KB |
Output is correct |
17 |
Correct |
164 ms |
3456 KB |
Output is correct |