Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Stuck With Distributing WeightsImplementing Logic
Difference between en2 and en3, changed 26 character(s)
I tried this problem (1366/A) a lot and still, I'm doing wrong something in it. Are there some hints for this problem?↵

I don't get what should I give priority for sticks or shovel. The only condition when I'm facing an error is -↵
when `a < b < 2*a` where a is number of limiting item.↵

I tried using binary search to find the midpoint of weightage or something like that but still no solution. Maybe I'm implementing incorrect logic. Is there anything I'm missing? I've tried this problem for a whole day now! Any help/hint would be greatly appreciated.↵

References-↵

Problem &mdash; [Codeforces](https://codeforces.com/) &mdash; [Shovels and Swords](https://codeforces.com/problemset/problem/1366/A)↵

Binary Search &mdash; [Python Pool](https://www.pythonpool.com/) &mdash; [Binary Search](https://www.pythonpool.com/binary-search-python/)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English freaks_geeks 2021-09-28 15:43:26 26 (published)
en2 English freaks_geeks 2021-09-28 15:41:58 6
en1 English freaks_geeks 2021-09-28 15:41:22 881 Initial revision (saved to drafts)