COOLING - getting WA

For the COOLING (easy) problem, I have submitted this answer. I am getting correct answers in the test cases provided. Apart from that, I have tried atleast 20 different cases. And nowhere am I getting an incorrect answer. So, why am I getting WA? Is it related to the bubble sort that I have used?

For input:

1
5
100 55 50 30 20
99 45 40 20 10

your program returns 4.

2 Likes

your solution fails for this test case
1
4
2 5 6 7
2 3 6 7
ans is 3 where as your solution gives 4

Thanks a lot! I made a silly logical error. Again, thanks!

Max N is 30 and max T is 30 too, so bubble sort is not a problem, but you should learn how to use sorting.

http://www.cplusplus.com/reference/cstdlib/qsort/

http://www.cplusplus.com/reference/algorithm/sort/