# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
13970 |
2015-04-24T17:03:05 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(S,1,0) < p(P[0].a*P[1].b+P[1].a*P[0].b,P[0].b*P[1].b,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 |
Incorrect |
0 ms |
4212 KB |
Output isn't correct |
3 |
Correct |
0 ms |
4212 KB |
Output is correct |
4 |
Correct |
0 ms |
4212 KB |
Output is correct |
5 |
Correct |
0 ms |
4212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
4212 KB |
Output isn't correct |
7 |
Correct |
0 ms |
4212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
4212 KB |
Output isn't correct |
2 |
Incorrect |
6 ms |
4212 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
4212 KB |
Output isn't correct |
4 |
Incorrect |
7 ms |
4212 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
4212 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
4212 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
4212 KB |
Output isn't correct |
8 |
Incorrect |
6 ms |
4212 KB |
Output isn't correct |
9 |
Correct |
7 ms |
4212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
385 ms |
4212 KB |
Output isn't correct |
2 |
Correct |
829 ms |
4212 KB |
Output is correct |
3 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
4 |
Correct |
486 ms |
4212 KB |
Output is correct |
5 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
8 |
Correct |
599 ms |
4212 KB |
Output is correct |
9 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
10 |
Incorrect |
370 ms |
4212 KB |
Output isn't correct |
11 |
Correct |
723 ms |
4212 KB |
Output is correct |
12 |
Incorrect |
323 ms |
4212 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
2 |
Incorrect |
727 ms |
4212 KB |
Output isn't correct |
3 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
4 |
Incorrect |
744 ms |
4212 KB |
Output isn't correct |
5 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
7 |
Incorrect |
409 ms |
4212 KB |
Output isn't correct |
8 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
11 |
Correct |
583 ms |
4212 KB |
Output is correct |
12 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
13 |
Incorrect |
715 ms |
4212 KB |
Output isn't correct |
14 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
15 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
16 |
Execution timed out |
1000 ms |
4212 KB |
Program timed out |
17 |
Correct |
734 ms |
4212 KB |
Output is correct |