How about
1
6 2
4 9 10 17 17 19
Your code outputs no
@achaitanyasai
@apptica
& @mjbpl
I got it…!!! I was checking poor test cases
…!! Can anyone suggest how to find such corner test cases???
Hello friends ![]()
Here is the link to my code
http://www.codechef.com/viewsolution/5602196
I’ve tried almost all corner test cases and even the ones mentioned above but still my code gives a WA. Please tell me where am I going wrong.
Well My code passed all of mine and all of the above… still WA for one of the subtasks (Task 1 - subtask 2) on codechef.
one of my submission: CodeChef: Practical coding for everyone
My algorithm was to
find all subsets of the given sanskar intensities
filter out the subsets having sum = sum(sanskars)/K
find such K subsets and check if all the sanskars have been used.
Anything I missed out?
My code is not passing for the last case only…for me it seems correct… point out the mistake please…
Link to code:CodeChef: Practical coding for everyone
Hey, I saw the editorial and understood the solution . But I used Greedy-Approach to solve the problem . Can anyone give me a testcase on which my solution is failing. (Try to avoid 0 based testcases as I am making some very obvious conceptual flaw.)And yaa its passing the above mentioned testcases.
I guess these are not corner cases, what I have done was : I have generated test cases using a script and checked your code with the accepted one. That’s all I did !!!, but you need to think(or try some random small cases using pen paper and check with them) if you didn’t have accepted code with you.
i think it should be “6 2…” instead of “7 2…”
Did you try this case :
1
1 8
0
Answer :
no
it’s printing “yes”!
Answer is no !!
Why?? It should be “yes” I guess because the sum is 0!
A “sanskar with 0 intensity” and “no sanskar” are not the same things!
Thanx! But even correcting this didn’t solve the problem! I’m getting 3 AC’s but still it is being evaluated as a WA.
even after correcting your code still prints “yes”
Take a look at 3rd case in lSfLUs - Online C++ Compiler & Debugging Tool - Ideone.com
I modified my code after you told me that! Take a look at my modified code - CodeChef: Practical coding for everyone
@faudar65 yes
9 4
2 9 5 8 1 5 5 2 4
Answer is “no”, but your output is “yes”
Did you try this case :
2 3
0 0
Answer is “no”
oops sorry I gave the wrong link, this one as well failed which passes the above test case… I was experimenting and removed a condition in the code that I provided the link for. The below passes every testcase so far given on this page