option a, b both are correct upon removing coin of specified denomination we will get the sum strictly less then the p provided in the question.
Welcome to the community man. Thanks for the reply
2 10
1 5ā¦ then it should be atleast 11 hereā¦ but the answer is āNOāā¦ how?
Thanks, you are welcome.
I have asked one moreā¦ please help xD
You canāt construct 11 without violating the rules described in the problem statement.If you subtract one from 11 it will be 10 which is equal to P(but it should me more than P), and you canāt construct 11 only with 5ās. So the answer is NO.
To construct 11ā¦ I can have 6 ones and 1 5ā¦ So if I remove 5 from itā¦ 11 becomes 6ā¦ is it likeā¦ if you remove any coin from the combinationā¦ you should not get 10ā¦?like 6 ones and 1 5ā¦ if I remove 1 from the onesā¦ I get 10ā¦ our result from all the possible must be less than 10 after removing?
If you remove any element from your multiset the sum of the elements should be less than P.
I implemented a solution based on the editorial, but Iām still getting a WA. I tried several random test cases, but canāt find one that causes my code to fail. Can anyone help me find a test case with which my code fails? CodeChef: Practical coding for everyone
see this at around 12:00 it will clear the doubt ā¦ mostly we did this as we have the denominations in ascending order .
CodeChef February Long Challenge 2020- No Change Required (NOCHANGE) - YouTube
Broooooo thanks a lot
https://www.codechef.com/viewsolution/29772452
Can anyone help me?
Iām getting correct answers for every test case but still its wrongā¦
Am I missing anything?
NICE EDITORIAL
denoting greater denomination by d2 and smaller by d1
when p % d2 = 0 and p%d1 = 0 and d2%d1 != 0
int x = p/d2 - 1;
will printing the following answer work ?
no. of coins of denomination d2 = x;
no. of coins of denomination d1 = x/d1 + 1;
This problem is a perfect example of why we need to be able to see the test cases after the contest is over. I have written code based on the insights from this editorial, yet I am still getting a WA. I have generated random test cases, but every test case I generate shows my code working perfectly. I am left to wonder if there is really something wrong with my code or if there is something wrong with the CodeChef test cases.
n <= 1000 in this problem, so n^2 is fine
Idk thats a max of 100 test cases so 10^6*10^2=10^8 which is okay i guess
That is not the worst case.
When all the numbers are divisors of p,
your first for loop will run atmost 30 times.
so that is, 30 times 1st loop1000 times 2nd loop100 Testcase = 3*10^6.
Another thing is, 10^8 can be okay because of no heavy operationsā¦
Thank you @tmwilliamlin for writing such a detailed and explanatory editorial.
I tried to solve the problem during contest but ended up with WA
Can someone please have a look and give me some test cases so that I can understand where I am getting it wrong?
https://www.codechef.com/viewsolution/29666614