Problem PHCUL of NOV Long Challenge 2019 has weak test cases.
Test cases generated here :
The solution in the above link fails to pass the above test case as Time complexity of the code in the worst case is O(N^3). But it still gets AC due to weak test cases.
Also, this problem was very unfair to Python users as one of my friend @ankushkhanna, when implemented his optimised code in Python in Practice Section (originally written in C++ during contest), it received TLE. While it got AC with very less time in C++. Also many Python users had hard time getting AC for PHCUL during contest.
Python Code : https://www.codechef.com/viewsolution/27875902
C++ Code : https://www.codechef.com/viewsolution/27785404
P.S. - Above C++ code passes the test cases stated in the beginning as its worst case Time Complexity can be said as approx O(N^2).
Heartiest thanks to @ankushkhanna for implementing the generator for the test case shown to him by me via a digram, building his C++ code in Python in most optimised version possible and helping me to verify that test cases are weak.
I request Admin/Problem Setter/Tester to kindly look into this matter.