Submission #19102

# Submission time Handle Problem Language Result Execution time Memory
19102 2016-02-18T10:49:05 Z Namnamseo Be Two Bees (OJUZ10_b2b) C++14
100 / 100
136 ms 1864 KB
#include <cstdio>

int n;
int eat[100010];
int make[100010];

int ch1, ch2;

typedef long long ll;
ll sumeat;

bool chk(double x){
    int mi=-1, smi=-1;
    double mv=-1e280, smv=-1e280;
    for(int i=0;i<n;++i){
        double cv=x*1.0/make[i]+eat[i];
        if(mv < cv){
            smv=mv; smi=mi;
            mv=cv; mi=i;
        } else if(smv<cv){
            smv=cv; smi=i;
        }
    }
    if(mv+smv >= sumeat){
        ch1=mi; ch2=smi;
        return true;
    }
    return false;
}

int main()
{
    scanf("%d",&n);
    int i;
    for(i=0;i<n;++i) scanf("%d",eat+i), sumeat += eat[i];
    for(i=0;i<n;++i) scanf("%d",make+i);
    double l=0, r=1e20, mid;
    for(i=0;i<100;++i){
        (chk(mid=(l+r)/2)?r:l)=mid;
    }
    //printf("value %f\n",r);
    if(ch1>ch2) ch2+=ch1, ch1=ch2-ch1, ch2=ch2-ch1;
    printf("%d %d\n",ch1+1,ch2+1);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1864 KB Output is correct
2 Correct 0 ms 1864 KB Output is correct
3 Correct 0 ms 1864 KB Output is correct
4 Correct 0 ms 1864 KB Output is correct
5 Correct 0 ms 1864 KB Output is correct
6 Correct 0 ms 1864 KB Output is correct
7 Correct 0 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1864 KB Output is correct
2 Correct 0 ms 1864 KB Output is correct
3 Correct 0 ms 1864 KB Output is correct
4 Correct 0 ms 1864 KB Output is correct
5 Correct 0 ms 1864 KB Output is correct
6 Correct 2 ms 1864 KB Output is correct
7 Correct 0 ms 1864 KB Output is correct
8 Correct 0 ms 1864 KB Output is correct
9 Correct 0 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 1864 KB Output is correct
2 Correct 133 ms 1864 KB Output is correct
3 Correct 127 ms 1864 KB Output is correct
4 Correct 132 ms 1864 KB Output is correct
5 Correct 121 ms 1864 KB Output is correct
6 Correct 64 ms 1864 KB Output is correct
7 Correct 76 ms 1864 KB Output is correct
8 Correct 130 ms 1864 KB Output is correct
9 Correct 70 ms 1864 KB Output is correct
10 Correct 127 ms 1864 KB Output is correct
11 Correct 43 ms 1864 KB Output is correct
12 Correct 129 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 131 ms 1864 KB Output is correct
2 Correct 44 ms 1864 KB Output is correct
3 Correct 129 ms 1864 KB Output is correct
4 Correct 133 ms 1864 KB Output is correct
5 Correct 91 ms 1864 KB Output is correct
6 Correct 133 ms 1864 KB Output is correct
7 Correct 135 ms 1864 KB Output is correct
8 Correct 126 ms 1864 KB Output is correct
9 Correct 78 ms 1864 KB Output is correct
10 Correct 135 ms 1864 KB Output is correct
11 Correct 136 ms 1864 KB Output is correct
12 Correct 129 ms 1864 KB Output is correct
13 Correct 129 ms 1864 KB Output is correct
14 Correct 93 ms 1864 KB Output is correct
15 Correct 133 ms 1864 KB Output is correct
16 Correct 133 ms 1864 KB Output is correct
17 Correct 125 ms 1864 KB Output is correct