KOJS WA from CodeOverFlow 1.1

Problem Link:

My Submission:

Can anyone tell what’s wrong? i applied the same logic with the help of sets and it worked?

1 Like

In insert query, the elements aren’t necessarily given in increasing order, hence query 3 fails

1 Like

We are supposed to do upper bound right to find the smallest element strictly greater than the element in the set ,

I tried doing lower bound and it also gave AC :frowning:

Why ? Are the testcases weak ? Or it is said somewhere z wont be equal to any of the elements in the set ?


1 Like

Even i am facing problem in this ques… can anyone plz tell why my code doesn’t give an AC!?

Oh! is it? lower_bound is wrong… Can u share the AC code?

Here you go : https://www.codechef.com/viewsolution/29308193

Oh… That must mean z is not a element present in the set. I guess it’s just weak test cases then

1 Like

It is because you are printing YES and not Yes and same for No
Change that and that would probably give AC


but its now giving runtime error …

plz have a look at my code and suggest possible changes