結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2023-10-23 17:35:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 47 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 82,548 KB |
実行使用メモリ | 60,524 KB |
最終ジャッジ日時 | 2024-09-22 11:30:47 |
合計ジャッジ時間 | 2,667 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
from collections import deques = input()dq = deque()cww = deque()mn = float("inf")for c in s:for i in range(len(dq)):dq[i] += 1if c == "c":dq.append(1)cww.append(0)if c == "w":for i in range(len(dq)):cww[i] += 1while cww and cww[0] == 2:cww.popleft()mn = min(mn, dq.popleft())print(mn if mn != float("inf") else -1)