How this solution works ? (Gold Mining , LTIME85 , Weak TC ? )

Question : Gold _Mine
I thought both (chef and chefu work in same mine) , and just submit and it works … I don’t even know whether it is optimal or not … or the test cases are weak ?

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--){
        ll n,i;
        cin>>n;
        ld g[n],a[n],b[n],sum1=0,sum2=0;
        for(i=0;i<n;i++){
            cin>>g[i]>>a[i]>>b[i];
            sum1+=(g[i]/(a[i]+b[i]))*b[i];
            sum2+=(g[i]/(a[i]+b[i]))*a[i];
        }
        cout<<fd(6)<<sum1<<" ";
        cout<<fd(6)<<sum2<<endl;
    }
}

My submission : 34815950

@galencolin

2 Likes

I got cheated by chef and chefu both :frowning:

2 Likes

I dont know why the quality of problems is so poor here at codechef , Nothing other than optimisation is there in this lunchtime, all the first 3 div1 problems just based on tricky optimisations and nothing else one problem was even copied this round must be unrated and I think problem setting has to be improved here. Why time limit on Problem 3 that is squared submatrices was so tight that even some heavy input will let us get TLE in lasts substask last case.

SUck codechef and suck everytime , never ever try learning from your mistake and allow plagiarism, nowadys setters are also doing plagiarism that is ridiculous.

4 Likes

I wrote a solution using the same logic, I think it should be correct because the cases are something like this:

  • Either they mine at the same speed in this mine
  • One has an advantage in this mine

This approach is clearly fine for the first case.

For the second case, the player who takes this as the optimal mine can take it later as well, his goal is to stop his opponent from getting more from another mine which is more optimal for him as this indirectly reduces the current player’s max possible score.

I know this is not at all a proper proof, just my intuition on which I wrote and submitted a solution like this, if anyone can give a proper proof that would be appreciated.

I’m too tired after ABC to really think about it, but I’ll write a bash and see if your solution holds up

3 Likes

it is optimal ,

The aim of chef and chefu is to get maximum gold (all gold)
chef and chefu are equally intelligent
If chef leaves any mine , he knows that chefu would mine that place
Similarly If chefu leaves any mine , he knows that chef would mine that place

If they get all gold , then they work on all mines
So thats why your solution is correct .

No issues bro… :slight_smile: Thanks for replying … BTW what’s your rank in ABC
PS : Please explain approach of 3rd question of ABC , when u are free …

I used the same method and my solution gets wrong answer link .Can anyone show me where i am wrong.

Uhh… using an alt for ABC so I’d rather not say that :stuck_out_tongue:

Sure I can explain it, after this

1 Like

You didn’t output with enough precision, or the bigger numbers got printed in scientific notation.

1 Like

The TL was tight to cut off the map solutions I guess.

1 Like

i forgot using precision .:frowning: and got WA on this with same solution

So, i need to even output even trailing zeros

K

see my all solutions

This is correct, I dont understand why this is optimal…

1 Like

Bro can u explain why this is optimal ?

You prove it by contradiction.

WHAT??? This was literally the first thing I tried and I got WA, can someone help why am i getting WA?
https://www.codechef.com/viewsolution/34752778

LMAO use set precision :slight_smile: