結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2021-01-25 11:46:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 333 bytes |
コンパイル時間 | 556 ms |
コンパイル使用メモリ | 82,404 KB |
実行使用メモリ | 54,132 KB |
最終ジャッジ日時 | 2024-06-13 04:41:52 |
合計ジャッジ時間 | 3,371 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
s = str(input()) C = [] W = [] for i, c in enumerate(s): if c == 'c': C.append(i) if c == 'w': W.append(i) import bisect INF = 10**18 ans = INF for ci in C: i = bisect.bisect_left(W, ci) if len(W)-i < 2: break ans = min(ans, W[i+1]-ci+1) if ans != INF: print(ans) else: print(-1)