답안 #14138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14138 2015-05-02T08:17:52 Z gs13105 Be Two Bees (OJUZ10_b2b) C++
33 / 100
1000 ms 3036 KB
#include <stdio.h>
#include <algorithm>

int h[100000];
int t[100000];
double f[100000];
int arr[100000];
const double EPS=1e-7;

inline bool cmp(const int& a, const int& b)
{
	return f[a]>f[b];
}

int main()
{
	int r1, r2, n, b, i;
	double m=0, s=0, g=500000000000000.0, x;
	scanf("%d", &n);
	for(i=0;i<n;i++)
		scanf("%d", &h[i]);
	for(i=0;i<n;i++)
		scanf("%d", &t[i]);
	for(i=0;i<n;i++)
		m+=h[i];
	for(b=0;b<60&&s+EPS<g;b++)
	{
		x=(s+g)/2;
		for(i=0;i<n;i++)
		{
			arr[i]=i;
			f[i]=x/t[i]+h[i];
		}
		std::sort(arr, arr+n,cmp);
		if(f[arr[0]]+f[arr[1]]>=m)
		{
			r1=std::min(arr[0], arr[1]);
			r2=std::max(arr[0], arr[1]);
			g=x;
		}
		else
			s=x;
	}
	printf("%d %d", r1+1, r2+1);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 3036 KB Output is correct
2 Correct 2 ms 3036 KB Output is correct
3 Correct 7 ms 3036 KB Output is correct
4 Correct 6 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 7 ms 3036 KB Output is correct
8 Correct 7 ms 3036 KB Output is correct
9 Correct 7 ms 3036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 629 ms 3036 KB Output is correct
2 Correct 893 ms 3036 KB Output is correct
3 Execution timed out 1000 ms 3036 KB Program timed out
4 Correct 392 ms 3036 KB Output is correct
5 Execution timed out 1000 ms 3036 KB Program timed out
6 Correct 329 ms 3036 KB Output is correct
7 Execution timed out 1000 ms 3036 KB Program timed out
8 Correct 513 ms 3036 KB Output is correct
9 Correct 438 ms 3036 KB Output is correct
10 Execution timed out 1000 ms 3036 KB Program timed out
11 Execution timed out 1000 ms 3036 KB Program timed out
12 Correct 782 ms 3036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1000 ms 3036 KB Program timed out
2 Execution timed out 1000 ms 3036 KB Program timed out
3 Correct 820 ms 3036 KB Output is correct
4 Correct 635 ms 3036 KB Output is correct
5 Correct 165 ms 3036 KB Output is correct
6 Correct 774 ms 3036 KB Output is correct
7 Execution timed out 1000 ms 3036 KB Program timed out
8 Execution timed out 1000 ms 3036 KB Program timed out
9 Execution timed out 1000 ms 3036 KB Program timed out
10 Execution timed out 1000 ms 3036 KB Program timed out
11 Execution timed out 1000 ms 3036 KB Program timed out
12 Execution timed out 1000 ms 3036 KB Program timed out
13 Execution timed out 1000 ms 3036 KB Program timed out
14 Correct 787 ms 3036 KB Output is correct
15 Execution timed out 1000 ms 3036 KB Program timed out
16 Execution timed out 1000 ms 3036 KB Program timed out
17 Correct 786 ms 3036 KB Output is correct