HERE IS MY C++ CODE
using namespace std;
#define get(a) scanf("%lld",&a)
#define yes printf("yes\n")
#define no printf("no\n")
long long int t,n,tmp,p,i,j,k,a,sum,sump,itr;
if(sum % p != 0 || p>n)
for(i=n-1;i>=0 && sum !=0 ;i--)
if(a[i]<=sum && a[i]!= 0)
if(sum != 0)
for(i=0; i < n ; i++)
I TRIED TO COVER ALL THE TEST CASES I FOUND PLZ SUGGEST ANY COUNTER TEST CASE
4 4 5 6 8 9
I got it…!!! I was checking poor test cases …!! Can anyone suggest how to find such corner test cases???
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…”
Here is the link to my code
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.
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 http://ideone.com/lSfLUs
I modified my code after you told me that! Take a look at my modified code - http://www.codechef.com/viewsolution/5602314
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: http://www.codechef.com/viewsolution/5600931
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?
2 9 5 8 1 5 5 2 4
Answer is “no”, but your output is “yes”
My code is not passing for the last case only…for me it seems correct… point out the mistake please…
Link to code:http://www.codechef.com/viewsolution/5599836