AT_abc482_b.Blank Bingo

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a 5×55\times 5 grid, and some of the cells are marked.

The current state of the grid is given by strings S1,S2,S3,S4,S5S_1,S_2,S_3,S_4,S_5 of length 55 consisting of o and ..
The cell at the ii-th row from the top and the jj-th column from the left is marked if the jj-th character of SiS_i is o, and unmarked if it is ..

Find the minimum number of additional marks needed to achieve a bingo.

Here, achieving a bingo means that there exist 55 cells lined up in a single vertical, horizontal, or diagonal line, all of which are marked.

有一个 5×55\times 5 的网格,其中部分格子已被标记。

当前网格的状态由长度为 55 的字符串 S1,S2,S3,S4,S5S_1,S_2,S_3,S_4,S_5 给出,每个字符串仅由字符 o 和 . 组成。
对于从上往下数第 ii 行、从左往右数第 jj 列的格子,若 SiS_i 的第 jj 个字符为 o,则该格子已被标记;若为 .,则未被标记。

求达成宾果(bingo)所需的最少额外标记数。

此处,“达成宾果”指存在一条由 55 个格子组成的直线(竖直、水平或对角线方向),且该直线上的所有格子均已被标记。

输入格式

The input is given from Standard Input in the following format:

S1S_1
S2S_2
S3S_3
S4S_4
S5S_5

输入从标准输入中按以下格式给出:

S1S_1
S2S_2
S3S_3
S4S_4
S5S_5

输出格式

Print the answer.

输出答案。

输入输出样例

  • 输入#1

    .o..o
    ..oo.
    .o..o
    o.o..
    o..oo

    输出#1

    2
  • 输入#2

    o..oo
    ...o.
    o.ooo
    oo.o.
    .o.oo

    输出#2

    0
  • 输入#3

    o..o.
    .o...
    ..o.o
    ..o..
    o...o

    输出#3

    1

说明/提示

Sample 1 Explanation:
For example, you can achieve a bingo by marking the 22 cells in the 55-th row from the top and the 22-nd and 33-rd columns from the left.

Sample 2 Explanation:
If a bingo is already achieved, no additional marks are needed, so the answer is 00.

Constraints

  • Each of S1,S2,S3,S4,S5S_1,S_2,S_3,S_4,S_5 is a string of length 55 consisting of o and ..

样例 1 解释:
例如,你可以通过标记从上往下数第 55 行、从左往右数第 22 列和第 33 列的 22 个格子来达成宾果(bingo)。

样例 2 解释:
如果宾果(bingo)已经达成,则无需再标记任何格子,因此答案为 00。

限制条件

  • S1,S2,S3,S4,S5S_1,S_2,S_3,S_4,S_5 中每个字符串长度均为 55,且仅由字符 o 和 . 组成。

输入解题思路,AI测评打分。不知道怎么写?

首页