結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2021-06-27 13:33:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 114 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-25 11:10:54 |
合計ジャッジ時間 | 2,095 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
def main(): S = list(input()) cww_lengthes = [] cww_store = [] for i in range(len(S)): if S[i] == 'c': if len(cww_store) == 0: cww_store.append(i) if S[i] == 'w': if len(cww_store) == 2: cww_lengthes.append(i - cww_store[0] + 1) cww_store = [] if len(cww_store) == 1: cww_store.append(i) print(min(cww_lengthes) if cww_lengthes else -1) if __name__ == '__main__': main()