結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2020-05-24 13:04:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 323 bytes |
| コンパイル時間 | 120 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-11 04:40:04 |
| 合計ジャッジ時間 | 2,201 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
import bisect s=input() clist = [] wlist = [] ans = 10**12 for i in range(len(s)): if s[i] == "c": clist.append(i) elif s[i] == "w": wlist.append(i) for i in clist: a = bisect.bisect_right(wlist, i) if len(wlist) <= a+1: break else: ans = min(wlist[a+1]-i+1, ans) if ans != 10**12: print(ans) else: print(-1)
shobonvip