AT_abc485_b.Faucets and Drains
入门
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A water tank has N faucets 1,2,…,N and M drains 1,2,…,M. Exactly one of the N faucets and M drains is clogged.
You are given N strings S1,S2,…,SN, each of length M and consisting of o and x. The j-th character of Si is o if water comes out of drain j when water is poured from faucet i (that is, neither faucet i nor drain j is clogged), and x otherwise.
Identify which of the N faucets and M drains is clogged. It is guaranteed that the answer can be uniquely determined from the input.
一个水箱有 N 个水龙头(编号为 1,2,…,N)和 M 个排水口(编号为 1,2,…,M)。其中,N 个水龙头和 M 个排水口中恰好各有一个被堵塞。
给定 N 个长度均为 M 的字符串 S1,S2,…,SN,每个字符串仅由字符 o 和 x 组成。字符串 Si 的第 j 个字符为 o,当且仅当从水龙头 i 注水时,水能从排水口 j 流出(即水龙头 i 和排水口 j 均未被堵塞);否则该字符为 x。
请确定被堵塞的水龙头(在 1 到 N 中)和被堵塞的排水口(在 1 到 M 中)。题目保证答案可由输入唯一确定。
输入格式
The input is given from Standard Input in the following format:
N M
S1
S2
⋮
SN
输入从标准输入中按以下格式给出:
N M
S1
S2
⋮
SN
输出格式
Print the answer in one line. If faucet i is clogged, print Faucet and i separated by a space. If drain j is clogged, print Drain and j separated by a space.
在一行中输出答案。如果水龙头 i 被堵塞,则输出 Faucet 和 i(中间用空格分隔)。如果排水口 j 被堵塞,则输出 Drain 和 j(中间用空格分隔)。
输入输出样例
输入#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 2 is clogged.
Constraints
- 2≤N≤100
- 2≤M≤100
- N and M are integers.
- Si is a string of length M consisting of
oandx. - The answer can be uniquely determined.
样例 1 解释:
水龙头 2 被堵塞了。
约束条件
- 2≤N≤100
- 2≤M≤100
- N 和 M 均为整数。
- Si 是一个长度为 M 的字符串,仅由字符
o和x组成。 - 答案可被唯一确定。
输入解题思路,AI测评打分。不知道怎么写?