Hello Codeforces Community!
I invite you all to take part in HackerRank's HourRank contest, scheduled on the 2nd of July 2017 at 20:30 IST.
Problems have been set by by me. I'd like to thank kevinsogo for his invaluable help in testing the problems and in all other aspects of the contest.
The problems will have subtasks to make them interesting for everyone. I strongly recommend to read all the problems.
The contestants are ranked by score. If two contestants get the same score, the person who reached the score first is ranked higher. Top 10 winners will receive a HackerRank T-Shirt.
Best of luck! :)
UPD: Contest has ended. Editorials are out. Congratulations to the top 10!
1. arsijo
2. adamant
3. kmjp
4. irkstepanov
5. RAVEman
6. SmallBoy
7. Tima
8. sahedsohel
9. fmota
10. lzw4896s
Contest starts in around 2 hours.
Auto comment: topic has been updated by satyaki3794 (previous revision, new revision, compare).
Auto comment: topic has been updated by satyaki3794 (previous revision, new revision, compare).
Easy solution for the last problem:
Let be the best cost for splitting first boxes. If we consider segments , there will be no more than different -values on it. We can check all of them in using array in which for each bit we keep the latest position where we met it. And for each value we should take the longest segment having it. We also have to calculate the longest possible suffix which is possible to take due to distinct values restrictions.
Code: link
Yes, the tester's code uses this observation, but he has used binary search to find these ranges, instead of checking the last position where each bit was modified.