#include<cstdio>
#include<algorithm>
using namespace std;
long long n,mh,cnt,s,a1,a2,c[100005];
double mn=10000000000000000000,t;
struct Data{
long long h,t,idx;
bool operator ()(Data q,Data w){
if(q.h>w.h)return true;
return false;
}
}d[100005],r[100005];
int main()
{
int i,j;
scanf("%d",&n);
for(i=0;i<n;s+=d[i++].h)
scanf("%d",&d[i].h);
for(i=0;i<n;d[i++].idx=i)
scanf("%d",&d[i].t);
sort(d,d+n,Data());
for(i=0;i<n;i++) {
if(c[d[i].h]<2){
c[d[i].h]++;
r[cnt++]=d[i];
}
}
for(i=0;i<cnt;i++){
for(j=i+1;j<cnt;j++) {
t=(double)(s-r[i].h-r[j].h)/((double)1/r[i].t+(double)1/r[j].t);
if(t<mn){
mn=t;
a1=r[i].idx+1;
a2=r[j].idx+1;
}
}
}
printf("%lld %lld",a1,a2);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
6552 KB |
Output isn't correct |
2 |
Incorrect |
11 ms |
6552 KB |
Output isn't correct |
3 |
Incorrect |
11 ms |
6552 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
5 |
Incorrect |
10 ms |
6552 KB |
Output isn't correct |
6 |
Incorrect |
11 ms |
6552 KB |
Output isn't correct |
7 |
Incorrect |
11 ms |
6552 KB |
Output isn't correct |
8 |
Incorrect |
3 ms |
6552 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
6552 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
2 |
Incorrect |
28 ms |
6552 KB |
Output isn't correct |
3 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
4 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
6 |
Incorrect |
31 ms |
6552 KB |
Output isn't correct |
7 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
8 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
10 |
Incorrect |
31 ms |
6552 KB |
Output isn't correct |
11 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
12 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
6552 KB |
Output isn't correct |
2 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
3 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
4 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
8 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
10 |
Incorrect |
26 ms |
6552 KB |
Output isn't correct |
11 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
12 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
13 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
14 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
15 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
16 |
Execution timed out |
1000 ms |
6548 KB |
Program timed out |
17 |
Incorrect |
29 ms |
6552 KB |
Output isn't correct |