답안 #14317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
14317 2015-05-12T03:10:55 Z comet Be Two Bees (OJUZ10_b2b) C++
0 / 100
1000 ms 4324 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,H[111111],T[111111],sum;
double a[111111];
bool check(double k){
	for(int i=0;i<n;i++)a[i]=(double)H[i]+k*T[i];
	sort(a,a+n);
	double ret=0;
	for(int i=2;i<n;i++)ret+=a[i];
	//printf("%f : %f\n",ret,k*sum);
	return ret>=k*sum;
}
void output(double k){
	double Min=1e9;
	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(Min>a[i]){
			Min=a[i];
			v=i;
		}
	}
	Min=1e9;
	for(int i=0;i<n;i++){
		if(Min>a[i]&&i!=v){
			Min=a[i];
			v2=i;
		}
	}
	printf("%d %d\n",v+1,v2+1);
}
int main(){
	scanf("%lld",&n);
	int x,y,z;
	for(int i=0;i<n;i++)scanf("%lld",&H[i]);
	for(int i=0;i<n;i++){
		scanf("%lld",&T[i]);
		sum+=T[i];
	}
	double lo=0,hi=1e9,mid;
	for(int i=0;i<100;i++){
		mid=(lo+hi)/2;
		if(check(mid)){
			lo=mid;
		}
		else{
			hi=mid;
		}
		//printf("%f %f\n",lo,hi);
	}
	output(hi);
}
# 결과 실행 시간 메모리 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 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 4 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 Incorrect 4 ms 4324 KB Output isn't correct
7 Incorrect 0 ms 4324 KB Output isn't correct
8 Correct 4 ms 4324 KB Output is correct
9 Incorrect 4 ms 4324 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 303 ms 4324 KB Output isn't correct
2 Incorrect 262 ms 4324 KB Output isn't correct
3 Execution timed out 1000 ms 4324 KB Program timed out
4 Incorrect 928 ms 4324 KB Output isn't correct
5 Incorrect 979 ms 4324 KB Output isn't correct
6 Incorrect 666 ms 4324 KB Output isn't correct
7 Correct 753 ms 4324 KB Output is correct
8 Incorrect 271 ms 4324 KB Output isn't correct
9 Incorrect 442 ms 4324 KB Output isn't correct
10 Incorrect 979 ms 4324 KB Output isn't correct
11 Incorrect 548 ms 4324 KB Output isn't correct
12 Incorrect 993 ms 4324 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 972 ms 4324 KB Output isn't correct
2 Incorrect 982 ms 4324 KB Output isn't correct
3 Incorrect 655 ms 4324 KB Output isn't correct
4 Incorrect 980 ms 4324 KB Output isn't correct
5 Correct 84 ms 4324 KB Output is correct
6 Incorrect 986 ms 4324 KB Output isn't correct
7 Correct 985 ms 4324 KB Output is correct
8 Correct 675 ms 4324 KB Output is correct
9 Incorrect 997 ms 4324 KB Output isn't correct
10 Incorrect 981 ms 4324 KB Output isn't correct
11 Incorrect 622 ms 4324 KB Output isn't correct
12 Incorrect 551 ms 4324 KB Output isn't correct
13 Incorrect 983 ms 4324 KB Output isn't correct
14 Incorrect 980 ms 4324 KB Output isn't correct
15 Incorrect 980 ms 4324 KB Output isn't correct
16 Incorrect 997 ms 4324 KB Output isn't correct
17 Incorrect 669 ms 4324 KB Output isn't correct