AT_abc485_b.Faucets and Drains

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

A water tank has NN faucets 1,2,…,N1,2,\dots,N and MM drains 1,2,…,M1,2,\dots,M. Exactly one of the NN faucets and MM drains is clogged.

You are given NN strings S1,S2,…,SNS_1,S_2,\dots,S_N, each of length MM and consisting of o and x. The jj-th character of SiS_i is o if water comes out of drain jj when water is poured from faucet ii (that is, neither faucet ii nor drain jj is clogged), and x otherwise.

Identify which of the NN faucets and MM drains is clogged. It is guaranteed that the answer can be uniquely determined from the input.

一个水箱有 NN 个水龙头(编号为 1,2,…,N1,2,\dots,N)和 MM 个排水口(编号为 1,2,…,M1,2,\dots,M)。其中,NN 个水龙头和 MM 个排水口中恰好各有一个被堵塞。

给定 NN 个长度均为 MM 的字符串 S1,S2,…,SNS_1,S_2,\dots,S_N,每个字符串仅由字符 o 和 x 组成。字符串 SiS_i 的第 jj 个字符为 o,当且仅当从水龙头 ii 注水时,水能从排水口 jj 流出(即水龙头 ii 和排水口 jj 均未被堵塞);否则该字符为 x。

请确定被堵塞的水龙头(在 11 到 NN 中)和被堵塞的排水口(在 11 到 MM 中)。题目保证答案可由输入唯一确定。

输入格式

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

NN MM
S1S_1
S2S_2
⋮\vdots
SNS_N

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

NN MM
S1S_1
S2S_2
⋮\vdots
SNS_N

输出格式

Print the answer in one line. If faucet ii is clogged, print Faucet and ii separated by a space. If drain jj is clogged, print Drain and jj separated by a space.

在一行中输出答案。如果水龙头 ii 被堵塞,则输出 Faucet 和 ii(中间用空格分隔)。如果排水口 jj 被堵塞,则输出 Drain 和 jj(中间用空格分隔)。

输入输出样例

  • 输入#1

    3 4
    oooo
    xxxx
    oooo

    输出#1

    Faucet 2
  • 输入#2

    4 3
    oxo
    oxo
    oxo
    oxo

    输出#2

    Drain 2
  • 输入#3

    2 2
    xo
    xo

    输出#3

    Drain 1

说明/提示

Sample 1 Explanation:
Faucet 22 is clogged.

Constraints

  • 2≤N≤1002 \leq N \leq 100
  • 2≤M≤1002 \leq M \leq 100
  • NN and MM are integers.
  • SiS_i is a string of length MM consisting of o and x.
  • The answer can be uniquely determined.

样例 1 解释:
水龙头 22 被堵塞了。

约束条件

  • 2≤N≤1002 \leq N \leq 100
  • 2≤M≤1002 \leq M \leq 100
  • NN 和 MM 均为整数。
  • SiS_i 是一个长度为 MM 的字符串,仅由字符 o 和 x 组成。
  • 答案可被唯一确定。

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

首页