PROTEPOI - Editorial

Can anyone tell me what’s wrong in my code?? All test cases in this post had pass…
Really cannot figure out what I am missing

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

Anyone please tell what’s wrong in my code.
https://www.codechef.com/viewsolution/14060633

Ok…so, once we have the x = the leftmost point not covered, then we see all those points coveering x and having k maximum,…and then update x=k+1
but then again we will have to see traverse all the points again…this will take O(N^2).Am i right…correct me plz, if i am!