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(){
    ll t;
        ll n,i;
        ld g[n],a[n],b[n],sum1=0,sum2=0;
        cout<<fd(6)<<sum1<<" ";

My submission : 34815950



I got cheated by chef and chefu both :frowning:


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.


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


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


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?

LMAO use set precision :slight_smile: