Submission #14209

# Submission time Handle Problem Language Result Execution time Memory
14209 2015-05-05T06:02:29 Z khsoo01 Be Two Bees (OJUZ10_b2b) C++
11 / 100
1000 ms 2744 KB
#include<cstdio>
#include<algorithm>
using namespace std;
long long n,mh,cnt,s,a1,a2;
double mn=987654321,t;
bool dom[100005];
struct Data{
    long long h,t;
    bool operator ()(Data q,Data w){
        if(q.t<w.t)return true;
        if(q.t==w.t && q.h>w.h)return true;
        return false;
    }
}r[100005];

int main()
{
    int i,j;
    scanf("%d",&n);
    for(i=0;i<n;s+=r[i++].h)
        scanf("%d",&r[i].h);
    for(i=0;i<n;i++)
        scanf("%d",&r[i].t);
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++) {
            t=s-r[i].h-r[j].h;
            if(t<mn*((double)1/r[i].t+(double)1/r[j].t)){
                mn=t/((double)1/r[i].t+(double)1/r[j].t);
                a1=i+1;
                a2=j+1;
            }
        }
    }
    printf("%lld %lld",a1,a2);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2744 KB Output is correct
2 Correct 0 ms 2744 KB Output is correct
3 Correct 0 ms 2744 KB Output is correct
4 Correct 0 ms 2744 KB Output is correct
5 Correct 0 ms 2744 KB Output is correct
6 Correct 0 ms 2744 KB Output is correct
7 Correct 0 ms 2744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2744 KB Output isn't correct
2 Correct 0 ms 2744 KB Output is correct
3 Correct 5 ms 2744 KB Output is correct
4 Incorrect 6 ms 2744 KB Output isn't correct
5 Incorrect 6 ms 2744 KB Output isn't correct
6 Incorrect 0 ms 2744 KB Output isn't correct
7 Incorrect 3 ms 2744 KB Output isn't correct
8 Correct 5 ms 2744 KB Output is correct
9 Incorrect 6 ms 2744 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 2740 KB Program timed out
2 Execution timed out 1000 ms 2740 KB Program timed out
3 Execution timed out 1000 ms 2740 KB Program timed out
4 Execution timed out 1000 ms 2740 KB Program timed out
5 Execution timed out 1000 ms 2740 KB Program timed out
6 Execution timed out 1000 ms 2740 KB Program timed out
7 Execution timed out 1000 ms 2740 KB Program timed out
8 Execution timed out 1000 ms 2740 KB Program timed out
9 Execution timed out 1000 ms 2740 KB Program timed out
10 Execution timed out 1000 ms 2740 KB Program timed out
11 Execution timed out 1000 ms 2740 KB Program timed out
12 Execution timed out 1000 ms 2740 KB Program timed out
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 2740 KB Program timed out
2 Execution timed out 1000 ms 2740 KB Program timed out
3 Execution timed out 1000 ms 2740 KB Program timed out
4 Execution timed out 1000 ms 2740 KB Program timed out
5 Execution timed out 1000 ms 2740 KB Program timed out
6 Execution timed out 1000 ms 2740 KB Program timed out
7 Execution timed out 1000 ms 2740 KB Program timed out
8 Execution timed out 1000 ms 2740 KB Program timed out
9 Execution timed out 1000 ms 2740 KB Program timed out
10 Execution timed out 1000 ms 2740 KB Program timed out
11 Execution timed out 1000 ms 2740 KB Program timed out
12 Execution timed out 1000 ms 2740 KB Program timed out
13 Execution timed out 1000 ms 2740 KB Program timed out
14 Execution timed out 1000 ms 2740 KB Program timed out
15 Execution timed out 1000 ms 2740 KB Program timed out
16 Execution timed out 1000 ms 2740 KB Program timed out
17 Execution timed out 1000 ms 2740 KB Program timed out