Paint2D-Crack
The beginning hacker-programmer Nevmiyko injured the source code of the licensed acquired graphics editor Paint2D. After the start an editor automatically creates the working field in a kind to the square by size N x N, and on him builds the maximally possible amount of rectangles by size 1 x M .
You know N and Ì, help to count up to Nevmiyko, what amount of operations Ê here automatically executes editor, if at the start he has only a template to the square 1 õ 1, and as a result of the unsuccessful breaking is able yet and "rotate" a rectangle 1 õ Ì on 90o.
We remind, that the licensed graphics editor was able to execute operations "select", "copy" "move" and "insert"
Specifications
Input
2 number is N and M. 1 <= N, M <= 1000.
Output
Amount of the Ê operations.
Problem information
Time Limit: 1 secondsMemory Limit: 64 MB
Balls for the passed test: 5
Complexity: 81% 8/43
Classes: Dynamic programming
Example
Example input4 3 |
Example output19 |
| ← New-year tree | Problems | Paint3D → |
