結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
👑 ![]() |
提出日時 | 2025-08-05 00:30:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 252 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,616 KB |
実行使用メモリ | 53,964 KB |
最終ジャッジ日時 | 2025-08-05 00:30:09 |
合計ジャッジ時間 | 3,198 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
S = input() dp = [float("-inf"),float("-inf")] ans = float("inf") for i,c in enumerate(S): if c == "c": dp[0] = i elif c == "w": ans = min(ans,i-dp[1]+1) dp[1] = dp[0] if ans == float("inf"): ans = -1 print (ans)