Submission #19118

# Submission time Handle Problem Language Result Execution time Memory
19118 2016-02-18T16:09:34 Z eaststar Be Two Bees (OJUZ10_b2b) C++14
0 / 100
1000 ms 2644 KB
#include <stdio.h>
int n,ai,aj;
long long h[100010],t[100010],H;
int f(double m){
    int i,mi,mj;
    double s,m1=0,m2=0;
    for(i=1;i<=n;++i){
        s=h[i]+m/t[i];
        if(m1<s)m2=m1,mj=mi,m1=s,mi=i;
        else if(m2<s)m2=s,mj=i;
    }
    if(m1+m2>=H)ai=mi,aj=mj;
    return m1+m2>=H;
}
int main(){
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;++i)scanf("%lld",h+i),H+=h[i];
    for(i=1;i<=n;++i)scanf("%lld",t+i);
    double l=0,r=1e10,m,ans;
    while(r-l>1e-8){
        m=(l+r)/2;
        if(f(m))ans=m,r=m;
        else l=m;
    }
    if(ai>aj)ai^=aj^=ai^=aj;
    printf("%d %d",ai,aj);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2644 KB Output is correct
2 Correct 0 ms 2644 KB Output is correct
3 Correct 0 ms 2644 KB Output is correct
4 Correct 0 ms 2644 KB Output is correct
5 Correct 0 ms 2644 KB Output is correct
6 Execution timed out 1000 ms 2640 KB Program timed out
7 Correct 0 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2644 KB Output isn't correct
2 Correct 0 ms 2644 KB Output is correct
3 Execution timed out 1000 ms 2640 KB Program timed out
4 Execution timed out 1000 ms 2640 KB Program timed out
5 Correct 0 ms 2644 KB Output is correct
6 Incorrect 0 ms 2644 KB Output isn't correct
7 Execution timed out 1000 ms 2640 KB Program timed out
8 Execution timed out 1000 ms 2640 KB Program timed out
9 Execution timed out 1000 ms 2640 KB Program timed out
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 2640 KB Program timed out
2 Incorrect 80 ms 2644 KB Output isn't correct
3 Correct 87 ms 2644 KB Output is correct
4 Incorrect 37 ms 2644 KB Output isn't correct
5 Execution timed out 1000 ms 2640 KB Program timed out
6 Execution timed out 1000 ms 2640 KB Program timed out
7 Execution timed out 1000 ms 2640 KB Program timed out
8 Incorrect 79 ms 2644 KB Output isn't correct
9 Incorrect 80 ms 2644 KB Output isn't correct
10 Execution timed out 1000 ms 2640 KB Program timed out
11 Incorrect 79 ms 2644 KB Output isn't correct
12 Correct 51 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 2640 KB Program timed out
2 Incorrect 87 ms 2644 KB Output isn't correct
3 Incorrect 80 ms 2644 KB Output isn't correct
4 Incorrect 87 ms 2644 KB Output isn't correct
5 Execution timed out 1000 ms 2640 KB Program timed out
6 Incorrect 87 ms 2644 KB Output isn't correct
7 Incorrect 86 ms 2644 KB Output isn't correct
8 Execution timed out 1000 ms 2640 KB Program timed out
9 Execution timed out 1000 ms 2640 KB Program timed out
10 Incorrect 77 ms 2644 KB Output isn't correct
11 Execution timed out 1000 ms 2640 KB Program timed out
12 Incorrect 59 ms 2644 KB Output isn't correct
13 Incorrect 83 ms 2644 KB Output isn't correct
14 Execution timed out 1000 ms 2640 KB Program timed out
15 Incorrect 26 ms 2644 KB Output isn't correct
16 Incorrect 87 ms 2644 KB Output isn't correct
17 Correct 63 ms 2644 KB Output is correct