i don’t want you to reveal anything about the solution.
seeing the time limit on the question, i thought any naive approach would not be enough. By then, i start to think that this is the typical NP-hard problem.
So, is it that typical NP-hard problem i’m thinking about?? But how can a NP-hard problem can run in the given time limit for this question. And if you apply DP(though i have 2 WA already), how can it work for large sums for subtask #2? P.S. If answering this reveals the solution or any algorithm applied to do this problem, then don’t answer it.
As far as I know, yes It is NP-Hard Problem…
& yes It can be solved, although I’m also wondering how, but submission results have shown that It is possible…
So, keep trying… Sleep. Code. Eat. Repeat.
As the constraints are low, it is possible to solve this NP-hard problem.But as a matter of fact, the subtask #2 is high for consideration. And yes, it is that NP-hard problem
what should be correct answer for this test case:
1 2
0
yes or no ?
answer is accepted for no, but if you see the last statement in problem, “output “yes” if it is possible to divide his sanskars equally amongst his followers” so 0 is allotted to 1st follower and then 2nd follower has nothing, sum is still zero, so shouldn’t that be a yes.