結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2019-04-03 23:15:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 595 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-23 12:38:13 |
合計ジャッジ時間 | 1,911 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 16 |
ソースコード
s = input() index_c = [] index_w = [] for x in s: if x == 'c': index_c.append(s.find(x)) s = s.replace('c', '0', 1) elif x == 'w': index_w.append(s.find(x)) s = s.replace('w', '1', 1) len_cww = [] for c in index_c: if len(index_c) == 0 or len(index_w) < 2: print(-1) break elif c < index_w[-2]: for w in range(len(index_w)): if c < index_w[w]: len_cww.append(index_w[w+1] - c + 1) break if len(len_cww) == 0: print(-1) else: print(max(len_cww))