Submission #14316

# Submission time Handle Problem Language Result Execution time Memory
14316 2015-05-12T03:02:55 Z comet Be Two Bees (OJUZ10_b2b) C++
0 / 100
545 ms 4324 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,H[111111],T[111111],a[111111],sum;
bool check(ll k){
	for(int i=0;i<n;i++)a[i]=H[i]+k*T[i];
	sort(a,a+n);
	ll ret=0;
	for(int i=2;i<n;i++)ret+=a[i];
	return ret>=k*sum;
}
void output(ll k){
	ll Min=1e18;
	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=1e18;
	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];
	}
	ll lo=0,hi=1e18,mid;
	while(lo+1<hi){
		mid=(lo+hi)/2;
		if(check(mid)){
			hi=mid;
		}
		else{
			lo=mid;
		}
	}
	output(hi);
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4324 KB Output isn't correct
2 Incorrect 1 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
8 Incorrect 0 ms 4324 KB Output isn't correct
9 Incorrect 0 ms 4324 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 249 ms 4324 KB Output isn't correct
2 Incorrect 304 ms 4324 KB Output isn't correct
3 Incorrect 167 ms 4324 KB Output isn't correct
4 Incorrect 509 ms 4324 KB Output isn't correct
5 Incorrect 539 ms 4324 KB Output isn't correct
6 Incorrect 537 ms 4324 KB Output isn't correct
7 Incorrect 532 ms 4324 KB Output isn't correct
8 Incorrect 155 ms 4324 KB Output isn't correct
9 Incorrect 372 ms 4324 KB Output isn't correct
10 Incorrect 534 ms 4324 KB Output isn't correct
11 Incorrect 143 ms 4324 KB Output isn't correct
12 Incorrect 415 ms 4324 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 543 ms 4324 KB Output isn't correct
2 Incorrect 300 ms 4324 KB Output isn't correct
3 Incorrect 537 ms 4324 KB Output isn't correct
4 Incorrect 540 ms 4324 KB Output isn't correct
5 Incorrect 539 ms 4324 KB Output isn't correct
6 Incorrect 151 ms 4324 KB Output isn't correct
7 Incorrect 534 ms 4324 KB Output isn't correct
8 Incorrect 543 ms 4324 KB Output isn't correct
9 Incorrect 542 ms 4324 KB Output isn't correct
10 Incorrect 365 ms 4324 KB Output isn't correct
11 Incorrect 535 ms 4324 KB Output isn't correct
12 Incorrect 545 ms 4324 KB Output isn't correct
13 Incorrect 361 ms 4324 KB Output isn't correct
14 Incorrect 538 ms 4324 KB Output isn't correct
15 Incorrect 382 ms 4324 KB Output isn't correct
16 Incorrect 368 ms 4324 KB Output isn't correct
17 Incorrect 529 ms 4324 KB Output isn't correct