답안 #14348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14348 2015-05-12T10:44:57 Z comet Be Two Bees (OJUZ10_b2b) C++
0 / 100
79 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){
    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("%lld",&H[i]);
		sum+=H[i];
    }
    for(int i=0;i<n;i++){
        scanf("%lf",&T[i]);
		T[i]=(double)1/T[i];
    }
    double lo=0,hi=1e15,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);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4324 KB Output isn't correct
2 Incorrect 0 ms 4324 KB Output isn't correct
3 Incorrect 0 ms 4324 KB Output isn't correct
4 Incorrect 0 ms 4324 KB Output isn't correct
5 Correct 0 ms 4324 KB Output is correct
6 Incorrect 0 ms 4324 KB Output isn't correct
7 Incorrect 0 ms 4324 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4324 KB Output isn't correct
2 Incorrect 0 ms 4324 KB Output isn't correct
3 Incorrect 0 ms 4324 KB Output isn't correct
4 Incorrect 0 ms 4324 KB Output isn't correct
5 Incorrect 0 ms 4324 KB Output isn't correct
6 Correct 0 ms 4324 KB Output is correct
7 Correct 0 ms 4324 KB Output is correct
8 Incorrect 0 ms 4324 KB Output isn't correct
9 Incorrect 0 ms 4324 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 4324 KB Output is correct
2 Correct 31 ms 4324 KB Output is correct
3 Incorrect 20 ms 4324 KB Output isn't correct
4 Incorrect 64 ms 4324 KB Output isn't correct
5 Correct 66 ms 4324 KB Output is correct
6 Correct 47 ms 4324 KB Output is correct
7 Incorrect 51 ms 4324 KB Output isn't correct
8 Incorrect 31 ms 4324 KB Output isn't correct
9 Correct 59 ms 4324 KB Output is correct
10 Correct 60 ms 4324 KB Output is correct
11 Correct 69 ms 4324 KB Output is correct
12 Incorrect 67 ms 4324 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 4324 KB Output is correct
2 Incorrect 67 ms 4324 KB Output isn't correct
3 Incorrect 70 ms 4324 KB Output isn't correct
4 Correct 78 ms 4324 KB Output is correct
5 Correct 76 ms 4324 KB Output is correct
6 Correct 79 ms 4324 KB Output is correct
7 Correct 53 ms 4324 KB Output is correct
8 Incorrect 77 ms 4324 KB Output isn't correct
9 Correct 77 ms 4324 KB Output is correct
10 Correct 79 ms 4324 KB Output is correct
11 Incorrect 46 ms 4324 KB Output isn't correct
12 Correct 50 ms 4324 KB Output is correct
13 Correct 77 ms 4324 KB Output is correct
14 Correct 69 ms 4324 KB Output is correct
15 Incorrect 74 ms 4324 KB Output isn't correct
16 Correct 71 ms 4324 KB Output is correct
17 Incorrect 71 ms 4324 KB Output isn't correct