QOJ.ac

QOJ

Time Limit: 0.5 s Memory Limit: 128 MB Total points: 100

#14477. 消毒

統計

最近在生物实验室工作的小 T 遇到了大麻烦。

由于实验室最近升级的缘故,他的分格实验皿是一个长方体,其尺寸为 $a \times b \times c$,$a$、$b$、$c$均为正整数。为了实验的方便,它被划分为 abc 个单位立方体区域,每个单位立方体尺寸为 $1 \times 1 \times 1$。用 $(i,j,k)$ 标识一个单位立方体,$1 \le i \le a$,$1 \le j \le b$,$1 \le k\le c$。

这个实验皿已经很久没有人用了,现在,小 T 被导师要求将其中一些单位立方体区域进行消毒操作(每个区域可以被重复消毒)。而由于严格的实验要求,他被要求使用一种特定的 F 试剂来进行消毒

这种 F 试剂特别奇怪,每次对尺寸为 $x \times y \times z$ 的长方体区域(它由 $x \cdot y \cdot z$ 个单位立方体组成)进行消毒时,只需要使用 $\min\{x,y,z\}$ 单位的 F 试剂。F 试剂的价格不菲,这可难倒了小 T。现在请你告诉他,最少要用多少单位的 F 试剂。(注:$\min\{x,y,z\}$ 表示 $x$、$y$、$z$ 中的最小者。)

输入格式

输入文件第一行是一个正整数 $D$,表示数据组数。

接下来是 $D$ 组数据,每组数据开头是三个数 $a,b,c$ 表示实验皿的尺寸。接下来会出现 $a$ 个 $b$ 行 $c$ 列的用空格隔开的 0/1 矩阵,0 表示对应的单位立方体不要求消毒,1 表示对应的单位立方体需要消毒;例如,如果第 1 个 01 矩阵的第 2 行第 3 列为 1,则表示单位立方体 $(1,2,3)$ 需要被消毒。

输入保证满足 $a \cdot b \cdot c \le 5\,000$, $T\le 3$。

输出格式

仅包含 $D$ 行,每行一个整数,表示对应实验皿最少要用多少单位的 F 试剂。

样例数据

样例输入

1
4 4 4
1 0 1 1
0 0 1 1
0 0 0 0
0 0 0 0
0 0 1 1
1 0 1 1
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0

样例输出

3
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.