#include<stdio.h>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define X first
#define Y second
int N;
int T[100010], H[100010];
ll S;
int p[2];
bool chk(double x){
double now[2] = {0}, re[2] = {0};
for(int i=0;i<N;i++){
double t = (double)H[i] + x / T[i];
if(now[0] < t)now[1] = now[0], re[1] = re[0], now[0] = t, re[0] = i;
else if(now[1] < t)now[1] = t, re[1] = i;
}
if((double)S - now[0] - now[1] < 0){
p[0] = min(re[0],re[1]) + 1;
p[1] = max(re[0],re[1]) + 1;
return true;
}
return false;
}
int main(){
scanf("%d",&N);
for(int i=0;i<N;i++)scanf("%d",H+i), S += H[i];
for(int i=0;i<N;i++)scanf("%d",T+i);
double low = 0, high = 1e10;
while((high - low) > 1e-10){
double mid = (low + high) / 2;
if(chk(mid))high = mid;
else low = mid;
}
printf("%d %d",p[0],p[1]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
2 |
Correct |
0 ms |
1864 KB |
Output is correct |
3 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
4 |
Correct |
0 ms |
1864 KB |
Output is correct |
5 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
6 |
Correct |
0 ms |
1864 KB |
Output is correct |
7 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
2 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
3 |
Correct |
0 ms |
1864 KB |
Output is correct |
4 |
Incorrect |
0 ms |
1864 KB |
Output isn't correct |
5 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
7 |
Incorrect |
1 ms |
1864 KB |
Output isn't correct |
8 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
2 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
3 |
Correct |
50 ms |
1864 KB |
Output is correct |
4 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
7 |
Incorrect |
84 ms |
1864 KB |
Output isn't correct |
8 |
Incorrect |
78 ms |
1864 KB |
Output isn't correct |
9 |
Incorrect |
78 ms |
1864 KB |
Output isn't correct |
10 |
Incorrect |
43 ms |
1864 KB |
Output isn't correct |
11 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
12 |
Incorrect |
83 ms |
1864 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
2 |
Incorrect |
90 ms |
1864 KB |
Output isn't correct |
3 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
4 |
Incorrect |
80 ms |
1864 KB |
Output isn't correct |
5 |
Incorrect |
94 ms |
1864 KB |
Output isn't correct |
6 |
Incorrect |
31 ms |
1864 KB |
Output isn't correct |
7 |
Incorrect |
84 ms |
1864 KB |
Output isn't correct |
8 |
Incorrect |
83 ms |
1864 KB |
Output isn't correct |
9 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
11 |
Incorrect |
79 ms |
1864 KB |
Output isn't correct |
12 |
Incorrect |
80 ms |
1864 KB |
Output isn't correct |
13 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
14 |
Incorrect |
56 ms |
1864 KB |
Output isn't correct |
15 |
Incorrect |
79 ms |
1864 KB |
Output isn't correct |
16 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |
17 |
Execution timed out |
1000 ms |
1860 KB |
Program timed out |