답안 #13951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
13951 2015-04-24T15:40:55 Z gs14004 Be Two Bees (OJUZ10_b2b) C++14
100 / 100
277 ms 2644 KB
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

int n;
int h[100005], u[100005];
long long S;

double tmp[100005];

int r1, r2;
bool trial(double t){
    for (int i=0; i<n; i++) {
        tmp[i] = h[i] + t / u[i];
    }
    double ret = 0;
    auto *pt = max_element(tmp,tmp+n);
    ret += *pt;
    r1 = (int)(pt - tmp) + 1;
    *pt = -1e18;
    pt = max_element(tmp,tmp+n);
    ret += *pt;
    r2 = (int)(pt - tmp) + 1;
    return ret >= S;
}

int main(){
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%d",&h[i]);
        S += h[i];
    }
    for (int i=0; i<n; i++) {
        scanf("%d",&u[i]);
    }
    double s = 0, e = 1e18;
    for (int i=0; i<200; i++) {
        double m = (s+e)/2;
        if(trial(m)) e = m;
        else s = m;
    }
    printf("%d %d",min(r1,r2),max(r1,r2));
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2644 KB Output is correct
2 Correct 3 ms 2644 KB Output is correct
3 Correct 2 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 3 ms 2644 KB Output is correct
7 Correct 0 ms 2644 KB Output is correct
8 Correct 3 ms 2644 KB Output is correct
9 Correct 3 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 273 ms 2644 KB Output is correct
2 Correct 178 ms 2644 KB Output is correct
3 Correct 133 ms 2644 KB Output is correct
4 Correct 273 ms 2644 KB Output is correct
5 Correct 151 ms 2644 KB Output is correct
6 Correct 158 ms 2644 KB Output is correct
7 Correct 272 ms 2644 KB Output is correct
8 Correct 263 ms 2644 KB Output is correct
9 Correct 273 ms 2644 KB Output is correct
10 Correct 266 ms 2644 KB Output is correct
11 Correct 90 ms 2644 KB Output is correct
12 Correct 272 ms 2644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 273 ms 2644 KB Output is correct
2 Correct 269 ms 2644 KB Output is correct
3 Correct 188 ms 2644 KB Output is correct
4 Correct 269 ms 2644 KB Output is correct
5 Correct 91 ms 2644 KB Output is correct
6 Correct 274 ms 2644 KB Output is correct
7 Correct 266 ms 2644 KB Output is correct
8 Correct 272 ms 2644 KB Output is correct
9 Correct 277 ms 2644 KB Output is correct
10 Correct 273 ms 2644 KB Output is correct
11 Correct 272 ms 2644 KB Output is correct
12 Correct 271 ms 2644 KB Output is correct
13 Correct 160 ms 2644 KB Output is correct
14 Correct 192 ms 2644 KB Output is correct
15 Correct 248 ms 2644 KB Output is correct
16 Correct 261 ms 2644 KB Output is correct
17 Correct 265 ms 2644 KB Output is correct