Weak Testcases in ZOMCAV?

Contest: Link
Solution:Link

I simply found the sum of the radiation level of each cave and i compared with sum of health levels, if equal then printed “YES” else then printed “NO”. For this i got AC

But my solution will fail for test cases like

Input:
1
5
3 2 1 2 5
4 5 5 5 1

the final radiation level is: 3 5 5 5 2
and there is no cave with radiation level 4 to kill the zombie with health level 4 so the output is "NO"

According to my solution the sum of radiation levels is 20 and the sum of the health levels is 20 , so it will give output as "YES"
So it failed …

But how i got AC ?
whether due to weak test cases or i was wrong
Thank you for reading …

5 Likes

That’s the point right. And apparently I used a list sort, after creating a list of final radiation level and then subtracting the lists to check if the max element is 0 or otherwise.

But guess what, it exceeds the time limit but such ill-thought solution end up getting AC.

This is my solution https://www.codechef.com/viewsolution/25868028.
Please let me know if there is anything wrong except the apparent TLE.

2 Likes

How did it even occur to you to try that solution? Do you try random solutions to see if they work?

4 Likes

This is my solution : https://www.codechef.com/viewsolution/25781531

This gives the correct answer.

1 Like

Reducing time complexity for checking equalities for 2 lists dint work for me , I had to reduce complexity of the part where you calculate the radiation level of each cave.

1 Like

Yes reducing the complexity of the part where you calculate the radiation level will help because O(n^2) will not work there because even n is 10^5 but C is 10^9 which will not work.

1 Like

My intention is not to try random solutions
I try to solve the problem in different approach but it failed
so i want to know how many test cases are satisfying with this way

2 Likes