COPS - Editorial

what is wrong with this??

Well, You may have a look at my code

variable m denotes the product, left holds the house number till we have checked and covered, and 100+m+1 is added to check for houses in the end, like 100, 99 …

Rest code is self-explanatory (java)

(Solved this for you)

Please UPVOTE…

Feel free to ask anything

1 Like

If problem related then here , Else than on discuss

My code isnt working despite correct logic. Pls help.

please check my solution PLEASE FOR GOD SAKE

I don’t know why i am getting wa. I seriously think my program solves for ever case. please tell me where i am wrong

Accepted Solution

disabling the line:
gave AC.

Using std::ios_base::sync_with_stdio(0);
This disables the synchronization between the C and C++ standard streams. By default, all standard streams are synchronized, which in practice allows you to mix C- and C+±style I/O and get sensible and expected results. If you disable the synchronization, then C++ streams are allowed to have their own independent buffers, which makes mixing C- and C+±style I/O an adventure.
Read it here.

Hope it helps!

1 Like

Aree waaah…Aap yahaan ??! :slight_smile: :slight_smile:

yeah, trying to contribute a little.:upside_down_face: :blush:

1 Like

Nice to see you :slight_smile: :slight_smile:

1 Like

Kindly check my solution. I have simply put some mathematics computation to solve this. but somehow it is not working.

Kindly let me know, what condition I have missed.

I am new to coding and somehow my code is not accepted . What case i am missing , pls let me know.

Here’s a simple failing testcase to help you debug:

1 9 4

… and here’s one for you :slight_smile:

2 9 1
61 1 

Here is an easy O(N) solution in cpp, just by storing the upper and lower bound for each cop we can check if any house is safe or not.(solution)

Thanks. It worked for me.

1 Like