BOARDGAME
CodeChefOpen on judge ↗
PRASHANT wants to play a challenging yet entertaining game since he is bored. He thus devised the board game "Annihilate the neighbours". There are N integers on a board in this game. He can select any integer valued at x off the board in a single move, and all subsequent integers with values of x+1 or x-1 are subsequently destroyed. He will gain x points with this move. He keeps playing the game
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start