結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
fV9TwBhUoa9S3eV
|
| 提出日時 | 2019-09-18 13:54:26 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 405 bytes |
| コンパイル時間 | 87 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-07-08 02:19:28 |
| 合計ジャッジ時間 | 2,144 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 10 |
ソースコード
# No.345 最小チワワ問題
import sys
s = input()
index_c = 0
index_w = 0
count_w = 0
length = sys.maxsize
for i in range(len(s)):
if s[i] == 'c':
index_c = i
count_w = 0
elif s[i] == 'w' and i > index_c:
index_w = i
count_w += 1
if count_w == 2:
length = min(length, index_w - index_c + 1)
print(length if length != sys.maxsize else -1)
fV9TwBhUoa9S3eV