LEAFEAT appears to have weak test cases (IARCSJUD)

How can a brute force solution that just marks elements in an array pass? Firstly, an array of size 10^9 should MLE. Second, in the worst case where N=10^9, K=20 and all caterpillars have length 1, it should definitely TLE. Is there some optimization I’m missing?

Link to solution

Thanks for reporting this. Yes, the data was weak. It has been partially fixed now, the time limit reduced to 1 second, and all submissions have been rejudged.