結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
_KingdomOfMoray
|
| 提出日時 | 2019-11-29 09:17:04 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 21 ms / 2,000 ms |
| + 937µs | |
| コード長 | 463 bytes |
| 記録 | |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2026-10-10 22:16:37 |
| 合計ジャッジ時間 | 2,383 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
ソースコード
text = input()
super_index = [i for i, c in enumerate(text) if c == 'c']
cww_len = []
for i in range(len(super_index)):
cur_index = super_index[i] + 1
w_count = 0
while cur_index < len(text):
if text[cur_index] == 'w':
w_count += 1
if w_count == 2:
cww_len.append(cur_index - super_index[i] + 1)
break
cur_index += 1
if len(cww_len) == 0:
print(-1)
else:
print(min(cww_len))
_KingdomOfMoray