結果
| 問題 | No.345 最小チワワ問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-12-02 18:43:11 |
| 言語 | Python3 (3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 719 bytes |
| 記録 | |
| コンパイル時間 | 61 ms |
| コンパイル使用メモリ | 14,720 KB |
| 実行使用メモリ | 10,240 KB |
| 最終ジャッジ日時 | 2026-12-02 18:43:27 |
| 合計ジャッジ時間 | 2,991 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 19 |
ソースコード
S = input()
cPos, wPos, w2Pos, minStep, temp = 0, 0, 0, 0, 0
for _ in range(S.count("c")):
if cPos==0 and wPos==0:
cPos = S.find("c")
wPos = S.find("w", cPos+1)
w2Pos = S.find("w", wPos+1)
temp = cPos
if cPos == -1 or w2Pos == -1 or wPos==-1:
minStep = -1
break
minStep = w2Pos - cPos + 1
else:
cPos = S.find("c", temp+1)
wPos = S.find("w", temp+1)
w2Pos = S.find("w", wPos+1)
temp = cPos
if (cPos == -1 or w2Pos == -1 or wPos==-1) and minStep==0:
minStep = -1
break
if minStep>w2Pos - cPos + 1 and w2Pos>cPos:
minStep = w2Pos - cPos + 1
print(minStep)