Submission #13939

# Submission time Handle Problem Language Result Execution time Memory
13939 2015-04-24T06:28:56 Z imsifile Be Two Bees (OJUZ10_b2b) C++
0 / 100
59 ms 7344 KB
#include<stdio.h>
#include<algorithm>
using namespace std;

struct a1 {
	long long h, t;
	int ix;
	bool operator< (const a1& c) const {
		if(h!=c.h)return h>c.h;
		return t<c.t;
	}
}ba1[100100];

struct a2 {
	long long h, t;
	int ix;
	bool operator< (const a2& c) const {
		if(t!=c.t)return t<c.t;
		return h>c.h;
	}
}ba2[100100];

int n, da, db;
long long sum, hi[100100], ti[100100];
double mi=0, mx, md;

double pick(int a, int b){
	double honey=sum-hi[a]-hi[b];
	double til=(1.0/ti[a])+(1.0/ti[b]);
	return honey/til;
}

int main(){
	int i;
	scanf("%d", &n);
	for(i=0; i<n; i++)scanf("%lld", &hi[i]), sum+=hi[i];
	for(i=0; i<n; i++)scanf("%lld", &ti[i]);
	for(i=0; i<n; i++){
		ba1[i].ix=ba2[i].ix=i;
		ba1[i].h=ba2[i].h=hi[i];
		ba1[i].t=ba2[i].t=ti[i];
	}
	sort(ba1,ba1+n);
	sort(ba2,ba2+n);
	da=ba1[0].ix, db=ba1[1].ix, mx=pick(da,db);
	if(da>db)swap(da,db);
	printf("%d %d", da+1, db+1);
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 7344 KB Output isn't correct
2 Incorrect 0 ms 7344 KB Output isn't correct
3 Correct 0 ms 7344 KB Output is correct
4 Incorrect 0 ms 7344 KB Output isn't correct
5 Incorrect 0 ms 7344 KB Output isn't correct
6 Incorrect 0 ms 7344 KB Output isn't correct
7 Incorrect 0 ms 7344 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 7344 KB Output isn't correct
2 Incorrect 0 ms 7344 KB Output isn't correct
3 Incorrect 0 ms 7344 KB Output isn't correct
4 Incorrect 0 ms 7344 KB Output isn't correct
5 Incorrect 0 ms 7344 KB Output isn't correct
6 Incorrect 0 ms 7344 KB Output isn't correct
7 Correct 0 ms 7344 KB Output is correct
8 Incorrect 0 ms 7344 KB Output isn't correct
9 Incorrect 0 ms 7344 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 7344 KB Output isn't correct
2 Incorrect 20 ms 7344 KB Output isn't correct
3 Incorrect 59 ms 7344 KB Output isn't correct
4 Correct 29 ms 7344 KB Output is correct
5 Incorrect 27 ms 7344 KB Output isn't correct
6 Incorrect 48 ms 7344 KB Output isn't correct
7 Incorrect 17 ms 7344 KB Output isn't correct
8 Incorrect 52 ms 7344 KB Output isn't correct
9 Incorrect 53 ms 7344 KB Output isn't correct
10 Incorrect 50 ms 7344 KB Output isn't correct
11 Incorrect 57 ms 7344 KB Output isn't correct
12 Incorrect 41 ms 7344 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 7344 KB Output isn't correct
2 Incorrect 54 ms 7344 KB Output isn't correct
3 Incorrect 42 ms 7344 KB Output isn't correct
4 Incorrect 38 ms 7344 KB Output isn't correct
5 Incorrect 48 ms 7344 KB Output isn't correct
6 Incorrect 48 ms 7344 KB Output isn't correct
7 Incorrect 28 ms 7344 KB Output isn't correct
8 Incorrect 46 ms 7344 KB Output isn't correct
9 Incorrect 51 ms 7344 KB Output isn't correct
10 Incorrect 41 ms 7344 KB Output isn't correct
11 Incorrect 52 ms 7344 KB Output isn't correct
12 Incorrect 56 ms 7344 KB Output isn't correct
13 Incorrect 13 ms 7344 KB Output isn't correct
14 Incorrect 59 ms 7344 KB Output isn't correct
15 Incorrect 39 ms 7344 KB Output isn't correct
16 Incorrect 57 ms 7344 KB Output isn't correct
17 Incorrect 55 ms 7344 KB Output isn't correct