답안 #19116

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19116 2016-02-18T13:52:46 Z tlwpdus Be Two Bees (OJUZ10_b2b) C++
0 / 100
190 ms 2648 KB
#include<stdio.h>
#include<algorithm>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
#define h first
#define t second

const ll INF = 1LL<<60;

int n;
pll arr[100100];
ll x;
ll S;

bool cmp(pll a, pll b) {
	return b.t*x+a.h*a.t*b.t<a.t*x+b.h+a.t*b.t;
}

pll m1, m2;
int t1, t2;
bool ok() {
	m1=pll(-1000000,1000000), m2 = pll(-1000000,1000000);
	int i;
	for (i=0;i<n;i++) {
		if (cmp(m1,arr[i])) m2=m1,m1=arr[i],t2=t1,t1=i;
		else if (cmp(m2,arr[i])) m2=arr[i],t2=i;
	}
	return (S-m1.h-m2.h)*m1.t*m2.t<=(m1.t+m2.t)*x;
}

void process() {
	int i;
	ll s = 0, e = INF;
	for (i=0;i<300;i++) {
		x = (s+e)/2;
		if (ok()) e=x;
		else s=x;
	}
	printf("%d %d\n",min(t1,t2)+1,max(t1,t2)+1);
}

void input() {
	int i;
	scanf("%d",&n);
	for (i=0;i<n;i++) scanf("%lld",&arr[i].h), S += arr[i].h;
	for (i=0;i<n;i++) scanf("%lld",&arr[i].t);
}

int main() {
	input();
	process();
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2648 KB Output isn't correct
2 Incorrect 0 ms 2648 KB Output isn't correct
3 Incorrect 0 ms 2648 KB Output isn't correct
4 Incorrect 0 ms 2648 KB Output isn't correct
5 Incorrect 0 ms 2648 KB Output isn't correct
6 Incorrect 0 ms 2648 KB Output isn't correct
7 Incorrect 0 ms 2648 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2648 KB Output isn't correct
2 Incorrect 0 ms 2648 KB Output isn't correct
3 Incorrect 0 ms 2648 KB Output isn't correct
4 Incorrect 0 ms 2648 KB Output isn't correct
5 Incorrect 0 ms 2648 KB Output isn't correct
6 Incorrect 0 ms 2648 KB Output isn't correct
7 Incorrect 3 ms 2648 KB Output isn't correct
8 Incorrect 0 ms 2648 KB Output isn't correct
9 Incorrect 0 ms 2648 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 93 ms 2648 KB Output isn't correct
2 Incorrect 159 ms 2648 KB Output isn't correct
3 Incorrect 156 ms 2648 KB Output isn't correct
4 Incorrect 142 ms 2648 KB Output isn't correct
5 Incorrect 147 ms 2648 KB Output isn't correct
6 Incorrect 73 ms 2648 KB Output isn't correct
7 Incorrect 54 ms 2648 KB Output isn't correct
8 Incorrect 153 ms 2648 KB Output isn't correct
9 Incorrect 111 ms 2648 KB Output isn't correct
10 Incorrect 154 ms 2648 KB Output isn't correct
11 Incorrect 151 ms 2648 KB Output isn't correct
12 Incorrect 153 ms 2648 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 173 ms 2648 KB Output isn't correct
2 Incorrect 164 ms 2648 KB Output isn't correct
3 Incorrect 152 ms 2648 KB Output isn't correct
4 Incorrect 151 ms 2648 KB Output isn't correct
5 Incorrect 158 ms 2648 KB Output isn't correct
6 Incorrect 108 ms 2648 KB Output isn't correct
7 Incorrect 190 ms 2648 KB Output isn't correct
8 Incorrect 151 ms 2648 KB Output isn't correct
9 Incorrect 156 ms 2648 KB Output isn't correct
10 Incorrect 54 ms 2648 KB Output isn't correct
11 Incorrect 103 ms 2648 KB Output isn't correct
12 Incorrect 151 ms 2648 KB Output isn't correct
13 Incorrect 155 ms 2648 KB Output isn't correct
14 Incorrect 161 ms 2648 KB Output isn't correct
15 Incorrect 94 ms 2648 KB Output isn't correct
16 Incorrect 158 ms 2648 KB Output isn't correct
17 Incorrect 151 ms 2648 KB Output isn't correct