結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-27 15:21:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 672 bytes |
| コンパイル時間 | 110 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-12-27 15:21:25 |
| 合計ジャッジ時間 | 2,370 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 14 |
ソースコード
S = str(input())
chiwawa_index_dict = {"c": 0, "first_w": 0, "second_w": 0}
has_filled_c = False
has_filled_first_w = False
has_filled_second_w = False
for i, word in enumerate(S):
if word == "c" and not has_filled_c:
chiwawa_index_dict["c"] = i
has_filled_c = True
elif word == "w" and has_filled_c and not has_filled_first_w:
chiwawa_index_dict["first_w"] = i
has_filled_first_w = True
elif word == "w" and has_filled_c and has_filled_first_w and not has_filled_second_w:
chiwawa_index_dict["second_w"] = i
has_filled_second_w = True
break
if has_filled_second_w:
print(chiwawa_index_dict["second_w"] - chiwawa_index_dict["c"] + 1)
else:
print(-1)