問題一覧 > 通常問題

No.1213 sio

レベル : / AI推定難易度 : 1900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 29
作問者 : simasima_71 / テスター : Rho
お気に入りにしたユーザー ProblemId : 4855 / 自分の提出
問題文最終更新日: 2020-08-29 23:00:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
技術室奥プログラミングコンテスト#5 Day2 (順位表) の他の問題:

Problem Statement

Siosio loves S-tetrominoes, I-tetrominoes, and O-tetrominoes.
For tetrominoes, please refer to this Wikipedia page.

Siosio places as many of these three types of tetrominoes as possible into a grid with $N$ rows and $M$ columns so that the number of leftover cells is minimized. (Rotation and reflection are allowed.)
However, I-tetrominoes are expensive, so he does not want to use many of them.

Output the minimum possible number of I-tetrominoes that Siosio uses.

Input

$N\ M$

All inputs are integers.
$1 \le N, M \le 100000000=10^8$

Output

Output the minimum number of I-tetrominoes.
Print a newline at the end.

Sample

Sample 1
Input
4 4
Output
0

A $4 \times 4$ grid can hold at most 4 tetrominoes, placed like this.

AABB
AABB
CCDD
CCDD
There is no need to use I-tetrominoes, so output $0$.
Sample 2
Input
1 11
Output
2

At most $2$ tetrominoes fit, as shown here.

.AAAA.BBBB.
There is no choice but to use $2$ I-tetrominoes.
Sample 3
Input
3 3
Output
0

At most $1$ tetromino fits.
If you place 1 S-tetromino, you do not need to use any I-tetrominoes.

Sample 4
Input
1 1
Output
0

No tetromino fits in the first place.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。