## New Year's 2016

It's almost 2016! A new year means setting new year resolutions, bettering yourself, and of course — a contest!

The problem writers this time will be k_53P, cheesecake, awaykened, Xyene, and FatalEagle.

The pretest/systest format will not be used. This means that submissions will be judged on the full set of data during the contest. However, partial output will be disabled.

**This contest will be rated for all participants.**

Before the contest, you may wish to check out the tips and help pages.

The contest will run from **Jan 1, 12 PM EST to Jan 3, 12 PM EST.** It will consist of 7-8 problems in approximated increasing order of difficulty. The problems will be allotted **different point values** based on their difficulties. As usual, if you cannot fully solve a problem, there are **subtasks** you can complete for partial points. We encourage contestants to read all problems and go for these partial marks. It is also highly recommended that you join and start the contest as soon as possible since ties are broken by your submission times.

After joining the contest, you proceed to the *Problems* tab to begin. You can also go to *Users* if you wish to see the rankings.

We have listed below some advice as well as contest strategies:

- Start from the beginning. Ties will be broken by the sum of times used to solve the problems starting from the beginning of the contest. Your last submission time will be used.
- Remove all extra debugging code and/or input prompts from your code before submitting. The judge is very strict — most of the time, it requires your output to
**match exactly**. - Do not pause program execution at the end. The judging process is automated. You should use
`stdin`

/`stdout`

to perform input / output, respectively. - It is guaranteed that all the problems will be solvable with C++.

**At the end of the contest, you may comment below to appeal a judging verdict. In the case of appeals, the decision(s) of DMOJ staff is final.**

Good luck and **Happy New Year!**

## Problems

Problem | Points | AC Rate | Users | |
---|---|---|---|---|

Late Christmas Shopping | 3p | 32.8% | 160 | |

The 365 Days of Christmas | 5p | 23.6% | 117 | |

Arithmetic Snowman | 7p | 19.7% | 118 | |

DIY Christmas Tree | 10p | 33.7% | 61 | |

Eggnog Dilemma | 12p | 5.3% | 27 | |

Cake Balancing | 15p | 37.2% | 67 | |

Old Christmas Lights | 17p | 15.4% | 53 | |

S-NO-wall | 20p | 11.1% | 37 |

## Comments

Ratings have been updated!

I love you bud

There won't be an official editorial so here are some rough solution sketches and hints:

P1 - Apologies once again for the issues with test data. Anyone who still WAs on the last case needs to consider the case where one bag has multiple copies of the same item.

P2 - Easy implementation, most errors were on the suffixes for the numbers.

P3 - Constraints were set loosely on this problem. Counting the occurrences of each size and sorting the sizes gives us a solution.

P4 - Multiple ways to approach this problem. One way is to DFS and get the size of the subtree rooted at each node. Number the nodes by depth and from left to right. For node , leave a "gap" between node and node equal to the size of 's subtree.

P5 - Consider a restricted version of the problem where . Some may have noticed that the inspiration for the problem came from a famous puzzle involving a king, some prisoners, and a poisoned barrel of wine.

P6 - Standard bitmask DP. The state is , the minimum number of moves required to reach the state where represents the items in the left pan and represents the items in the right pan.

P7 - Consider a restricted version of the problem where queries have no upper bound. In other words, what is the maximum size consistent subarray of ?

P8 - We can use segment tree where each node keeps track of the contiguous prefix and suffix length of 1s in that segment. When merging nodes, the new maximum contiguous section is either the prefix, suffix, or the new section created by merging the two.

Hope you guys enjoyed the contest. Happy new year!

Anyone knows the puzzle name for problem 5?

http://gurmeet.net/puzzles/poisoned-wine-barrels/

Thx

"All the King's Wine"

Thx

Pascal is not available for this contest?

Happy new year everybody :)

P1 was on a separate judge, it's now available for all languages.

Thanks a lot!

HAPPY NEW YEAR

YOU TOO BUD

What kind of difficulty levels can we expect, roughly speaking?

With lots of problems and lots of time, there will be something for everyone!

If there will be something for Fatal, you, etc., it's going to be hard ;_;

They probably made an Aubrey Alston-style problem just for you (which is why there are 7 problems, not 6)

There may be 8 problems actually, not confirmed yet :)

last year's was pretty hard :/