CHEFNWRK Wrong Answer

Can someone tall me why my answer is wrong.
[https://www.codechef.com/COOK121B/problems/CHEFNWRK]
https://www.codechef.com/viewsolution/37086155

What if more than one value is greater than k

1 Like

You should break the loop after finding any element greater than K and making T=1

1 Like

Never break without taking whole input

1 Like

See Full editorial here Full Editorial -COOK121B ( All Problems ) of all problems of cookoff

Nope he should use another loop for checking

Why should I make T=1?

Single loop

Just take input and continue if you have t=1 already
here’s your ac code @not_a_coder26

You are printing extra -1 's in some cases like
1
5 5
6 5 6 5