Submission #19127

# Submission time Handle Problem Language Result Execution time Memory
19127 2016-02-18T16:24:05 Z eaststar Be Two Bees (OJUZ10_b2b) C++14
11 / 100
68 ms 2644 KB
#include <stdio.h>
int n,ai=1,aj=2;
long long h[100010],t[100010],H;
int chk(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;
}
double f(){
    double x=H-h[ai]-h[aj],y=1.0/t[ai]+1.0/t[aj];
    return x/y;
}
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=1e9,m;
    while((r-l)/r>1e-10){
        m=(l+r)/2;
        if(chk(m))r=f();
        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 Correct 0 ms 2644 KB Output is correct
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 Incorrect 0 ms 2644 KB Output isn't correct
3 Correct 0 ms 2644 KB Output is correct
4 Incorrect 0 ms 2644 KB Output isn't correct
5 Incorrect 0 ms 2644 KB Output isn't correct
6 Correct 0 ms 2644 KB Output is correct
7 Incorrect 0 ms 2644 KB Output isn't correct
8 Incorrect 0 ms 2644 KB Output isn't correct
9 Correct 1 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 2644 KB Output isn't correct
2 Incorrect 38 ms 2644 KB Output isn't correct
3 Incorrect 61 ms 2644 KB Output isn't correct
4 Incorrect 23 ms 2644 KB Output isn't correct
5 Incorrect 60 ms 2644 KB Output isn't correct
6 Incorrect 52 ms 2644 KB Output isn't correct
7 Correct 62 ms 2644 KB Output is correct
8 Correct 46 ms 2644 KB Output is correct
9 Incorrect 55 ms 2644 KB Output isn't correct
10 Correct 36 ms 2644 KB Output is correct
11 Incorrect 18 ms 2644 KB Output isn't correct
12 Incorrect 64 ms 2644 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 2644 KB Output isn't correct
2 Incorrect 67 ms 2644 KB Output isn't correct
3 Correct 22 ms 2644 KB Output is correct
4 Incorrect 46 ms 2644 KB Output isn't correct
5 Incorrect 57 ms 2644 KB Output isn't correct
6 Incorrect 60 ms 2644 KB Output isn't correct
7 Correct 59 ms 2644 KB Output is correct
8 Incorrect 59 ms 2644 KB Output isn't correct
9 Incorrect 56 ms 2644 KB Output isn't correct
10 Incorrect 39 ms 2644 KB Output isn't correct
11 Incorrect 63 ms 2644 KB Output isn't correct
12 Incorrect 62 ms 2644 KB Output isn't correct
13 Incorrect 60 ms 2644 KB Output isn't correct
14 Incorrect 61 ms 2644 KB Output isn't correct
15 Incorrect 67 ms 2644 KB Output isn't correct
16 Correct 67 ms 2644 KB Output is correct
17 Correct 43 ms 2644 KB Output is correct