답안 #15755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15755 2015-07-19T18:46:03 Z cki86201 Be Two Bees (OJUZ10_b2b) C++
11 / 100
103 ms 1864 KB
#include<stdio.h>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;

typedef long long ll;
typedef pair<int,int> Pi;
#define X first
#define Y second

int N;
int T[100010], H[100010];
ll S;
int p[2];

bool chk(double x){
	double now[2] = {0}, re[2] = {0};
	for(int i=0;i<N;i++){
		double t = (double)H[i] + x / T[i];
		if(now[0] < t)now[1] = now[0], re[1] = re[0], now[0] = t, re[0] = i;
		else if(now[1] < t)now[1] = t, re[1] = i;
	}
	if((double)S - now[0] - now[1] < 0){
		p[0] = min(re[0],re[1]) + 1;
		p[1] = max(re[0],re[1]) + 1;
		return true;
	}
	return false;
}

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",T+i);
	double low = 0, high = 1e10;
	for(int i=0;i<60;i++){
		double mid = (low + high) / 2;
		if(chk(mid))high = mid;
		else low = mid;
	}
	printf("%d %d",p[0],p[1]);
	return 0;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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 1 ms 1864 KB Output is correct
5 Incorrect 0 ms 1864 KB Output isn't correct
6 Correct 0 ms 1864 KB Output is correct
7 Correct 1 ms 1864 KB Output is correct
8 Incorrect 0 ms 1864 KB Output isn't correct
9 Correct 0 ms 1864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 43 ms 1864 KB Output isn't correct
2 Incorrect 80 ms 1864 KB Output isn't correct
3 Correct 95 ms 1864 KB Output is correct
4 Correct 47 ms 1864 KB Output is correct
5 Incorrect 88 ms 1864 KB Output isn't correct
6 Correct 88 ms 1864 KB Output is correct
7 Correct 37 ms 1864 KB Output is correct
8 Incorrect 87 ms 1864 KB Output isn't correct
9 Correct 56 ms 1864 KB Output is correct
10 Correct 65 ms 1864 KB Output is correct
11 Incorrect 92 ms 1864 KB Output isn't correct
12 Correct 89 ms 1864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 1864 KB Output is correct
2 Incorrect 62 ms 1864 KB Output isn't correct
3 Incorrect 96 ms 1864 KB Output isn't correct
4 Correct 52 ms 1864 KB Output is correct
5 Correct 93 ms 1864 KB Output is correct
6 Incorrect 29 ms 1864 KB Output isn't correct
7 Incorrect 96 ms 1864 KB Output isn't correct
8 Incorrect 95 ms 1864 KB Output isn't correct
9 Incorrect 89 ms 1864 KB Output isn't correct
10 Incorrect 103 ms 1864 KB Output isn't correct
11 Correct 90 ms 1864 KB Output is correct
12 Correct 66 ms 1864 KB Output is correct
13 Correct 93 ms 1864 KB Output is correct
14 Incorrect 89 ms 1864 KB Output isn't correct
15 Correct 88 ms 1864 KB Output is correct
16 Incorrect 102 ms 1864 KB Output isn't correct
17 Incorrect 95 ms 1864 KB Output isn't correct