COPS - Editorial

what is wrong with this??
https://www.codechef.com/viewsolution/21204870

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)

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

(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.
https://www.codechef.com/viewsolution/24481962

please check my solution PLEASE FOR GOD SAKE

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

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
https://www.codechef.com/viewsolution/25405662

Accepted Solution

disabling the line:
//std::ios_base::sync_with_stdio(0);
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.
Source:
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.

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

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.https://www.codechef.com/viewsolution/26055237

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

1
1 9 4
19 

… and here’s one for you :slight_smile:

1
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