Submission #14096

# Submission time Handle Problem Language Result Execution time Memory
14096 2015-05-01T16:21:05 Z exqt Be Two Bees (OJUZ10_b2b) C++
33 / 100
6 ms 1720 KB
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;

#define in cin
#define out cout
#define _abs(a) ((a)>0?(a):(-(a)))
#define _min(a,b) ((a)>(b)?(b):(a))
#define _max(a,b) ((a)<(b)?(b):(a))
#define isin(a,b,c) ((a)<=(c)&&(c)<=(b))
#define REP(i,e) for(int i=0; i<e; i++)
#define REP2(i,s,e) for(int i=s; i<e; i++)
#define REPE(i,s,e) for(int i=s; i<=e; i++)
#define REPR(i,s,e) for(int i=e; i>=s; i--)
#define X first
#define Y second
#define pdd pair<double, double>

int main()
{
    int n; in >> n; if(n > 1111) return 0;
    vector< pdd > o(n), v(n);

    REP(i,n) in >> v[i].Y;
    REP(i,n) in >> v[i].X;
    REP(i,n) o[i] = v[i];

    sort(v.begin(), v.end());

    double sum = 0.0;
    REP(i,n) sum += v[i].Y;

    //X:time Y:honey
    double mint = 98765432109876543210.0;
    int mina, minb;
    REP(i,v.size())
    {
        REP2(j,i+1,v.size())
        {
            double k = v[i].X;
            double m = v[i].Y;
            double t = (k - (k*k)/(k+v[j].X))*(sum-m-v[j].Y);

            if(mint > t)
            {
                mint = t;
                mina = i, minb = j;
            }
        }
    }

    int ra, rb;
    REP(i,n)
    {
        if(v[mina] == o[i]) ra = i;
        if(v[minb] == o[i]) rb = i;
    } ra++; rb++;

    if(ra > rb)
        out << rb << " " << ra << endl;
    else
        out << ra << " " << rb << endl;

    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 0 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 0 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 0 ms 1720 KB Output is correct
7 Correct 0 ms 1720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1720 KB Output is correct
2 Correct 6 ms 1720 KB Output is correct
3 Correct 0 ms 1720 KB Output is correct
4 Correct 6 ms 1720 KB Output is correct
5 Correct 0 ms 1720 KB Output is correct
6 Correct 6 ms 1720 KB Output is correct
7 Correct 6 ms 1720 KB Output is correct
8 Correct 6 ms 1720 KB Output is correct
9 Correct 6 ms 1720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
2 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
3 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
4 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
5 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
6 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
7 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
8 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
9 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
10 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
11 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
12 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
2 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
3 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
4 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
5 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
6 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
7 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
8 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
9 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
10 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
11 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
12 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
13 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
14 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
15 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
16 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected
17 Incorrect 0 ms 1716 KB Output isn't correct - wrong output format : Unexpected end of file - int32 expected