Submission #14347

# Submission time Handle Problem Language Result Execution time Memory
14347 2015-05-12T10:34:39 Z gs14004 Be Two Bees (OJUZ10_b2b) C++14
0 / 100
825 ms 3688 KB
#include<cstdio>
#include <algorithm>

using namespace std;
int n;
double sum,H[111111],T[111111],a[111111];
bool check(double k){
    for(int i=0;i<n;i++)a[i]=H[i]+k*T[i];
    sort(a,a+n);
    double ret=0;
    for(int i=0;i<n-2;i++)ret+=a[i];
    return ret<k*sum;
}
void output(double k){
    double Max=0;
    int v,v2;
    for(int i=0;i<n;i++)a[i]=H[i]+k*T[i];
    for(int i=0;i<n;i++){
        if(Max<a[i]){
            Max=a[i];
            v=i;
        }
    }
    Max=0;
    for(int i=0;i<n;i++){
        if(Max<a[i]&&i!=v){
            Max=a[i];
            v2=i;
        }
    }
    printf("%d %d\n",v+1,v2+1);
}
int main(){
    scanf("%d",&n);
    int x,y,z;
    for(int i=0;i<n;i++)scanf("%lf",&H[i]);
    for(int i=0;i<n;i++){
        scanf("%lf",&T[i]);
        T[i]=(double)1/T[i];
        sum+=H[i];
    }
    double lo=0,hi=1e16,mid;
    for(int i=0;i<80;i++){
        mid=(lo+hi)/2;
        if(check(mid)){
            hi=mid;
        }
        else{
            lo=mid;
        }
        //printf("%f %f\n",hi,lo);
    }
    output(lo);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3688 KB Output isn't correct
2 Incorrect 0 ms 3688 KB Output isn't correct
3 Incorrect 0 ms 3688 KB Output isn't correct
4 Incorrect 0 ms 3688 KB Output isn't correct
5 Incorrect 0 ms 3688 KB Output isn't correct
6 Incorrect 0 ms 3688 KB Output isn't correct
7 Correct 0 ms 3688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3688 KB Output isn't correct
2 Incorrect 4 ms 3688 KB Output isn't correct
3 Incorrect 0 ms 3688 KB Output isn't correct
4 Incorrect 0 ms 3688 KB Output isn't correct
5 Incorrect 1 ms 3688 KB Output isn't correct
6 Incorrect 5 ms 3688 KB Output isn't correct
7 Incorrect 4 ms 3688 KB Output isn't correct
8 Incorrect 4 ms 3688 KB Output isn't correct
9 Incorrect 4 ms 3688 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 216 ms 3688 KB Output is correct
2 Incorrect 800 ms 3688 KB Output isn't correct
3 Incorrect 541 ms 3688 KB Output isn't correct
4 Incorrect 812 ms 3688 KB Output isn't correct
5 Incorrect 808 ms 3688 KB Output isn't correct
6 Incorrect 608 ms 3688 KB Output isn't correct
7 Incorrect 216 ms 3688 KB Output isn't correct
8 Incorrect 448 ms 3688 KB Output isn't correct
9 Incorrect 769 ms 3688 KB Output isn't correct
10 Incorrect 797 ms 3688 KB Output isn't correct
11 Incorrect 365 ms 3688 KB Output isn't correct
12 Incorrect 247 ms 3688 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 3688 KB Output isn't correct
2 Incorrect 815 ms 3688 KB Output isn't correct
3 Incorrect 817 ms 3688 KB Output isn't correct
4 Incorrect 800 ms 3688 KB Output isn't correct
5 Incorrect 815 ms 3688 KB Output isn't correct
6 Incorrect 825 ms 3688 KB Output isn't correct
7 Incorrect 550 ms 3688 KB Output isn't correct
8 Incorrect 514 ms 3688 KB Output isn't correct
9 Incorrect 453 ms 3688 KB Output isn't correct
10 Incorrect 807 ms 3688 KB Output isn't correct
11 Incorrect 810 ms 3688 KB Output isn't correct
12 Incorrect 552 ms 3688 KB Output isn't correct
13 Incorrect 808 ms 3688 KB Output isn't correct
14 Incorrect 806 ms 3688 KB Output isn't correct
15 Incorrect 551 ms 3688 KB Output isn't correct
16 Incorrect 825 ms 3688 KB Output isn't correct
17 Incorrect 811 ms 3688 KB Output isn't correct