結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2025-02-11 21:01:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 307 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 82,108 KB |
実行使用メモリ | 69,552 KB |
最終ジャッジ日時 | 2025-02-11 21:01:45 |
合計ジャッジ時間 | 3,126 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
def f(ss):cnt = 0for s in ss:if s == "c" and cnt == 0:cnt += 1if s == "w" and (1 <= cnt <= 2):cnt += 1return cnt == 3S = input()N = len(S)ans = 105for i in range(N):for j in range(i + 1, N + 1):if f(S[i:j]):ans = min(ans, j - i)print(ans) if ans != 105 else print(-1)