Invitation to CodeChef July Long Challenge 2018!

Non-negative includes 0 by default rules.

1 Like

cout << endl;
works for c++ā€¦ use it whenever u wanna flushā€¦

1 Like

My first challenge here and NMNMX already became my most hated problem ever. First day I quickly tried brute force on it and got 20 points. Last 5 days have been working on it day and night and improved a lot but still getting 20 points. Is it possible to solve that problem with Python (in normal ways, I got a way to solve it but itā€™s kinda cheating :P)?

Finally passed all test cases! Weird thing one of the first thing I tried days ago helped me. At that I didnā€™t use it because it was taking forever in my local pc, but here codechef dealed with quickly:)

strangeā€¦

remove your duplicate answers nowā€¦ as u got attention and replyā€¦

@admin

so regarding the MAGIC_SET problem, does the order matter.

because for {1 2 1}, both {1 2} and {2 1} are sub-sequences but the elements are same. So is the order meant to be maintained?

When will editorials be posted? Can someone please explain their approach for Gears !!

Didnā€™t have time to implement it, but I guess you can model it it as a graph. If a odd-length cycle exists in a component, then the whole component is ā€œblockedā€. Otherwise, for any two gears X and Y, you can find the speed of Y given Xā€¦ the intermediate gears are quite irrelevant.

Gears? Its a straightforwad DSU - refer here https://cp-algorithms.com/data_structures/disjoint_set_union.html#toc-tgt-11

1 Like

Thanks a lot ! I never solved many problems with DSUā€¦just basic ones, i was not aware of it, will have a look at it.

HERE is my codeā€¦
Its neatā€¦
DSU (without path compression (u ll understand why if u go with my logic of bool invert))
Hint: assign 0 or 1 sign to each node (for detecting cycle and for detecting sign of rotating)ā€¦

Thank you!! will refer it :slight_smile:

yes it is possible to solve in python, I passed mine in just 0.24 seconds.
You can have a look at it from searching my name on the leaderboard

Editorial links for PDELIV and SUBWAY july18 are not working.
@admin

Thats coz they arent uploaded yet. Editorialist is still writing them.

long challenge lasts for 10 daysā€¦ do codechef hide solutions from editorialist till contest gets ended ? If no , why not still editorialist was able to complete them !!!

Ask that from editorialist himself @l_returns xD. No, he gets all solutions and setterā€™s explanation.

Sorry guys! It was my fault, Didnā€™t read the question properly.

Itā€™s been two days since contest ended and we still donā€™t have editorials for all problemsā€¦please add them