TRIP2 - Editorial

I can give you a failing testcase to help you debug :slight_smile:

1
7 2
-1 -1 1 -1 -1 -1 -1 

1 Like

still a case pending corrected it.

I got 70, CodeChef: Practical coding for everyone

Now consider:

1
6 2
2 1 -1 -1 1 2 
1 Like

Link to latest submission?

https://www.codechef.com/viewsolution/26197173

https://www.codechef.com/viewsolution/26197173
Latest submission

Thank you. Figured it out.

1 Like

https://www.codechef.com/viewsolution/26178967
Anyone please help me with the corner cases.

Hmmm … small random testcases don’t seem to find any problems. Dunno, sorry :slight_smile:

No problem…Thnx!!

1 Like

Ah - try this:

2
57 2
-1 -1 -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 -1 
82 2
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
  

That’s why I didn’t find it with randomised testcases - I always set T=1, whereas your issue only appears when there are multiple testcases. (Hint: there’s some state left over from previous testcases that you’re not clearing :))

Consider:

1
1 9
-1 

Thanx bro for your time…finally submitted successfully!!!:v:

1 Like

@aryan12

Thnakyou so very much , i was unable to find the case where it was failing .
Thank you :innocent::innocent::innocent::innocent::innocent:

Thankyou so much , it got submiited , their was a error of one character , i CHANGED + TO - AND BOOM !!!

1 Like

yes! Stacks size seems to the problem. Thank you for pointing out.

1 Like

What’s wrong ??

https://www.codechef.com/viewsolution/26200425

Thanks for actually linking your solution :slight_smile:

It fails for the following testcase:

1
5 2
2 -1 -1 -1 -1 

I get a 403 error when trying to access your solution :confused:

That is not the link to your solution XD The correct link is: CodeChef: Practical coding for everyone

Consider the testcase:

1
10 2
-1 -1 -1 -1 -1 2 -1 -1 -1 2