Submission #14349

# Submission time Handle Problem Language Result Execution time Memory
14349 2015-05-12T10:49:53 Z comet Be Two Bees (OJUZ10_b2b) C++
0 / 100
174 ms 4324 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll sum,H[111111];
double T[111111],a[111111];
bool check(double k){
    for(int i=0;i<n;i++)a[i]=H[i]+k/T[i];
    double ret=0;
    double* t=max_element(a,a+n);
    ret+=*t;
    *t=-1e18;
    t=max_element(a,a+n);
    ret+=*t;
    return ret>sum;
}
void output(double k){
    for(int i=0;i<n;i++)a[i]=H[i]+k/T[i];
    double* t=max_element(a,a+n);
    printf("%d ",t-a+1);
    *t=-1e18;
    t=max_element(a,a+n);
    printf("%d\n",t-a+1);
}
int main(){
    scanf("%d",&n);
    int x,y,z;
    for(int i=0;i<n;i++){
		scanf("%lld",&H[i]);
		sum+=H[i];
    }
    for(int i=0;i<n;i++){
        scanf("%lf",&T[i]);
    }
    double lo=0,hi=1e18,mid;
    for(int i=0;i<100;i++){
        mid=(lo+hi)/2;
        if(check(mid)){
            hi=mid;
        }
        else{
            lo=mid;
        }
        //printf("%f %f\n",hi,lo);
    }
    output(hi);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 4324 KB Output isn't correct
2 Incorrect 0 ms 4324 KB Output isn't correct
3 Correct 0 ms 4324 KB Output is correct
4 Incorrect 0 ms 4324 KB Output isn't correct
5 Incorrect 0 ms 4324 KB Output isn't correct
6 Incorrect 0 ms 4324 KB Output isn't correct
7 Incorrect 0 ms 4324 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4324 KB Output is correct
2 Incorrect 0 ms 4324 KB Output isn't correct
3 Correct 0 ms 4324 KB Output is correct
4 Incorrect 0 ms 4324 KB Output isn't correct
5 Incorrect 0 ms 4324 KB Output isn't correct
6 Incorrect 0 ms 4324 KB Output isn't correct
7 Incorrect 0 ms 4324 KB Output isn't correct
8 Incorrect 0 ms 4324 KB Output isn't correct
9 Incorrect 0 ms 4324 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 168 ms 4324 KB Output is correct
2 Correct 107 ms 4324 KB Output is correct
3 Incorrect 157 ms 4324 KB Output isn't correct
4 Correct 158 ms 4324 KB Output is correct
5 Correct 82 ms 4324 KB Output is correct
6 Correct 157 ms 4324 KB Output is correct
7 Correct 158 ms 4324 KB Output is correct
8 Incorrect 116 ms 4324 KB Output isn't correct
9 Incorrect 57 ms 4324 KB Output isn't correct
10 Incorrect 99 ms 4324 KB Output isn't correct
11 Correct 150 ms 4324 KB Output is correct
12 Incorrect 165 ms 4324 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 166 ms 4324 KB Output is correct
2 Incorrect 160 ms 4324 KB Output isn't correct
3 Correct 163 ms 4324 KB Output is correct
4 Correct 56 ms 4324 KB Output is correct
5 Incorrect 174 ms 4324 KB Output isn't correct
6 Correct 161 ms 4324 KB Output is correct
7 Correct 167 ms 4324 KB Output is correct
8 Correct 173 ms 4324 KB Output is correct
9 Correct 172 ms 4324 KB Output is correct
10 Correct 119 ms 4324 KB Output is correct
11 Correct 174 ms 4324 KB Output is correct
12 Incorrect 164 ms 4324 KB Output isn't correct
13 Incorrect 173 ms 4324 KB Output isn't correct
14 Incorrect 166 ms 4324 KB Output isn't correct
15 Correct 118 ms 4324 KB Output is correct
16 Incorrect 102 ms 4324 KB Output isn't correct
17 Correct 163 ms 4324 KB Output is correct