# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
13965 |
2015-04-24T16:33:38 Z |
kriii |
Be Two Bees (OJUZ10_b2b) |
C++14 |
|
693 ms |
3428 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
int N,H[100100],T[100100],S;
struct p{
p(){
a = i = 0;
}
p(double a_, int i_){
a = a_; i = i_;
}
double a; int i;
bool operator <(const p t) const{
return a > t.a;
}
}P[100100];
bool go(double m)
{
for (int i=0;i<N;i++){
P[i] = p(m/T[i]+H[i],i+1);
}
sort(P,P+N);
return P[0].a + P[1].a > S;
}
int main()
{
scanf ("%d",&N);
for (int i=0;i<N;i++){
scanf ("%d",&H[i]); S += H[i];
}
for (int j=0;j<N;j++) scanf ("%d",&T[j]);
double l = 0, r = 1e9, m;
for (int i=0;i<60;i++){
m = (l + r) / 2;
if (go(m)) r = m;
else l = m;
}
go(l);
int a = P[0].i, b = P[1].i;
if (a > b) swap(a,b);
printf ("%d %d\n",a,b);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3428 KB |
Output is correct |
2 |
Correct |
0 ms |
3428 KB |
Output is correct |
3 |
Correct |
0 ms |
3428 KB |
Output is correct |
4 |
Correct |
0 ms |
3428 KB |
Output is correct |
5 |
Correct |
0 ms |
3428 KB |
Output is correct |
6 |
Correct |
0 ms |
3428 KB |
Output is correct |
7 |
Correct |
0 ms |
3428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3428 KB |
Output is correct |
2 |
Correct |
0 ms |
3428 KB |
Output is correct |
3 |
Correct |
4 ms |
3428 KB |
Output is correct |
4 |
Correct |
4 ms |
3428 KB |
Output is correct |
5 |
Correct |
2 ms |
3428 KB |
Output is correct |
6 |
Correct |
0 ms |
3428 KB |
Output is correct |
7 |
Correct |
0 ms |
3428 KB |
Output is correct |
8 |
Correct |
0 ms |
3428 KB |
Output is correct |
9 |
Correct |
4 ms |
3428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
666 ms |
3428 KB |
Output is correct |
2 |
Correct |
634 ms |
3428 KB |
Output is correct |
3 |
Correct |
668 ms |
3428 KB |
Output is correct |
4 |
Correct |
670 ms |
3428 KB |
Output is correct |
5 |
Correct |
535 ms |
3428 KB |
Output is correct |
6 |
Correct |
181 ms |
3428 KB |
Output is correct |
7 |
Incorrect |
375 ms |
3428 KB |
Output isn't correct |
8 |
Incorrect |
313 ms |
3428 KB |
Output isn't correct |
9 |
Correct |
234 ms |
3428 KB |
Output is correct |
10 |
Correct |
685 ms |
3428 KB |
Output is correct |
11 |
Correct |
209 ms |
3428 KB |
Output is correct |
12 |
Correct |
466 ms |
3428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
459 ms |
3428 KB |
Output is correct |
2 |
Correct |
671 ms |
3428 KB |
Output is correct |
3 |
Correct |
683 ms |
3428 KB |
Output is correct |
4 |
Incorrect |
690 ms |
3428 KB |
Output isn't correct |
5 |
Incorrect |
182 ms |
3428 KB |
Output isn't correct |
6 |
Correct |
693 ms |
3428 KB |
Output is correct |
7 |
Correct |
461 ms |
3428 KB |
Output is correct |
8 |
Correct |
484 ms |
3428 KB |
Output is correct |
9 |
Correct |
673 ms |
3428 KB |
Output is correct |
10 |
Incorrect |
377 ms |
3428 KB |
Output isn't correct |
11 |
Correct |
676 ms |
3428 KB |
Output is correct |
12 |
Correct |
679 ms |
3428 KB |
Output is correct |
13 |
Correct |
671 ms |
3428 KB |
Output is correct |
14 |
Correct |
467 ms |
3428 KB |
Output is correct |
15 |
Incorrect |
674 ms |
3428 KB |
Output isn't correct |
16 |
Correct |
670 ms |
3428 KB |
Output is correct |
17 |
Correct |
688 ms |
3428 KB |
Output is correct |