Mini-Tetris 3023
시간 제한2초메모리 제한1024 MB
정사각형 a개, S타일 b개, 코너 c개가 주어질 때, 일부 타일로 정확히 채울 수 있는 2 x n 직사각형의 최대 너비 n을 구한다.
문제
A guy named Gry found a new game called "Mini-Tetris 3023". This small version of Tetris is played on a very long grid only cells high and has just three types of tile:
- A
squaremade out of tiles in a grid. - An
S-tilemade out of tiles, on one row and slightly offset on the other - A
cornermade out of tiles, on one row and on the other
Tiles may be rotated , , , or degrees to fit amongst each other, however, they cannot overlap or go outside the vertical boundary of the grid.

This game provides squares, S-tiles, and corners. Gry would like to beat the high score by creating the largest-possible contiguous rectangle out of some or all of the provided tiles, without any tiles overlapping or sticking out of the rectangle.
입력
- The sole line of input contains three integers , , and () --- the number of squares, S-tiles, and corners, respectively.
출력
Output the maximum possible width of the grid, , that can be perfectly filled by some or all of the given tiles without overlapping or overstepping the boundaries.