結果
| 問題 |
No.672 最長AB列
|
| コンテスト | |
| ユーザー |
B9syDOfYhHFXecu
|
| 提出日時 | 2018-10-31 10:13:42 |
| 言語 | Python2 (2.7.18) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 717 bytes |
| コンパイル時間 | 764 ms |
| コンパイル使用メモリ | 6,948 KB |
| 実行使用メモリ | 7,040 KB |
| 最終ジャッジ日時 | 2024-11-19 11:53:02 |
| 合計ジャッジ時間 | 2,163 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 16 |
ソースコード
s = input()
now_word = ''
change_index_list = []
for index, word in enumerate(s):
if index == 0:
now_word = word
if word != now_word:
change_index_list.append(index)
now_word = word
change_index_list.append(len(s))
change_index_list.insert(0, 0)
max_len = 0
candidate_index = 0
for index, change_index in enumerate(change_index_list):
if index == 0:
continue
elif index == len(change_index_list) - 1:
break
else:
candidate_index = min([change_index - change_index_list[index-1], change_index_list[index+1] - change_index])
if max_len < candidate_index:
max_len = candidate_index
print(2*max_len)
B9syDOfYhHFXecu