結果
問題 | No.345 最小チワワ問題 |
ユーザー |
![]() |
提出日時 | 2020-01-17 11:05:19 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 351 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-25 15:48:10 |
合計ジャッジ時間 | 2,379 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
S = input()N = len(S)ans = N + 1for i in range(N):for j in range(i + 1, N + 1):T = S[i:j]try:idx = T.index("c")idx = T.index("w", idx + 1)T.index("w", idx + 1)ans = min(ans, len(T))except:continueif ans == N + 1:print(-1)else:print(ans)