GOLMINE - Editorial

It might be lack of understanding from your side

I never said that I misunderstood the problem statement, but I had to read it over 10 times to get what the question said. Thus, I felt that the problem statement is poorly constructed.

Don’t blame the setters for your mistake

How is this my mistake? And I never blamed the setters. I just said that the statements were poorly constructed, and setters should take care. If you don’t understand stuff, don’t post irrelevant things please.

leave this platform if you find problem statements here “poorly constructed”.

Why shall I leave the platform for one statement? And you are no one to take my decisions.

Saying this, I bet you haven’t read the statement I had made more than once. Try reading it again, maybe then you will understand what I meant.

There were several arguments that it would be optimal for both Chef and Chefu to be in the mine with the maximum \frac{G_i}{A_i + B_i}. I find kingofnumber’s argument to be the most convincing. The only potential issue I see with it is that it assumes for every time t, there is some positive dt such that no switching happens between times t and t + dt. If there’s some nonempty time interval where there is switching at every instant in that time interval (if that even makes any sense mathematically), then no matter how small dt is there would be switching before t and t + dt. Other than that, I think it’s a solid proof.

Use long double instead of double.
My solution:

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector <long double> g(n), a(n), b(n);
        for (int i = 0; i < n; ++i) cin >> g[i] >> a[i] >> b[i];
        long double aans = 0, bans = 0;
        for (int i = 0; i < n; ++i)
        {
            bans += ((g[i]*a[i])/(a[i]+b[i]));
            aans += ((g[i]*b[i])/(a[i]+b[i]));
        }
        cout << fixed << setprecision(5) << aans << " ";
        cout << fixed << setprecision(5) << bans << '\n';
    }
}

Can someone please debug my piece of code??Its giving TLE…

Use fast i/o

dont use endl ‘\n’ is much more faster.

My solution is CodeChef: Practical coding for everyone
I am getting a TLE can anyone please explain why?

Remove long long and double. Use long double instead. Use fast IO.

ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

Use '\n' instead of endl.

Thanks ,

Yep thought the same at the very first time i read the question just take a case : 30 1 2 and 15 2 1 . When i applied on this tc on copy i observed the correct one

i guess such problem was also present in some codeforces div2 round but was asked for 500 pt i.e the task A. seeing it here on place of task d makes me sad!!! :slight_smile: