C - Dango 解説 by evima
Proposer's ImplementationIf either o
or -
is absent in \(S\), the answer is \(-1\). Otherwise, the answer is the maximum number of consecutive o
in \(S\), because if both o
and -
exist, any “block” of o
is adjacent to -
.
Sample Implementation (Python)
N, S = input(), input()
print(max(map(len, S.split('-'))) if 'o' in S and '-' in S else -1)
P.S. Here is dango:
投稿日時:
最終更新: