Comments

My 96-point solution for device2 , which got the highest points among all the solutions submitted in JOISC contest 3.

In my opinion, this is just a extension of the 80-point solution which have been mentioned for many times.

But I don't think there's an easy way to get a full solution by improving this algorithm.

Solution
Anna.cpp
Bruno.cpp

Sorry for my poor English.

Look forward to a full solution.