# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
13971 |
2015-04-24T17:04:59 Z |
kriii |
Be Two Bees (OJUZ10_b2b) |
C++14 |
|
1000 ms |
4212 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
int N,H[100100],T[100100],S;
struct p{
p(){
a = b = i = 0;
}
p(double a_, long long b_, int i_){
a = a_; b = b_; i = i_;
}
double a; long long b; int i;
bool operator <(const p t) const{
return a * t.b > b * t.a;
}
}P[100100];
bool go(double m)
{
for (int i=0;i<N;i++){
P[i] = p(m+T[i]*H[i],T[i],i+1);
}
sort(P,P+N);
return p(P[0].a*P[1].b+P[1].a*P[0].b,P[0].b*P[1].b,0) < p(S,1,0);
}
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<70;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 |
0 ms |
4212 KB |
Output is correct |
2 |
Correct |
0 ms |
4212 KB |
Output is correct |
3 |
Correct |
0 ms |
4212 KB |
Output is correct |
4 |
Correct |
0 ms |
4212 KB |
Output is correct |
5 |
Correct |
1 ms |
4212 KB |
Output is correct |
6 |
Correct |
0 ms |
4212 KB |
Output is correct |
7 |
Correct |
1 ms |
4212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4212 KB |
Output is correct |
2 |
Correct |
3 ms |
4212 KB |
Output is correct |
3 |
Correct |
6 ms |
4212 KB |
Output is correct |
4 |
Correct |
7 ms |
4212 KB |
Output is correct |
5 |
Incorrect |
3 ms |
4212 KB |
Output isn't correct |
6 |
Correct |
3 ms |
4212 KB |
Output is correct |
7 |
Correct |
6 ms |
4212 KB |
Output is correct |
8 |
Correct |
3 ms |
4212 KB |
Output is correct |
9 |
Correct |
0 ms |
4212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
381 ms |
4212 KB |
Output is correct |
2 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
3 |
Correct |
368 ms |
4212 KB |
Output is correct |
4 |
Correct |
326 ms |
4212 KB |
Output is correct |
5 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
6 |
Incorrect |
583 ms |
4212 KB |
Output isn't correct |
7 |
Correct |
720 ms |
4212 KB |
Output is correct |
8 |
Correct |
833 ms |
4212 KB |
Output is correct |
9 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
11 |
Incorrect |
485 ms |
4212 KB |
Output isn't correct |
12 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
2 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
3 |
Incorrect |
732 ms |
4212 KB |
Output isn't correct |
4 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
7 |
Incorrect |
759 ms |
4212 KB |
Output isn't correct |
8 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
9 |
Correct |
721 ms |
4212 KB |
Output is correct |
10 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
11 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
12 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
13 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
14 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
15 |
Incorrect |
594 ms |
4212 KB |
Output isn't correct |
16 |
Correct |
720 ms |
4212 KB |
Output is correct |
17 |
Incorrect |
185 ms |
4212 KB |
Output isn't correct |