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