結果
問題 | No.672 最長AB列 |
ユーザー | 👑 H20 |
提出日時 | 2020-11-05 12:58:56 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 312 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 86,924 KB |
実行使用メモリ | 98,184 KB |
最終ジャッジ日時 | 2023-09-29 16:52:08 |
合計ジャッジ時間 | 4,757 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,140 KB |
testcase_01 | AC | 72 ms
71,444 KB |
testcase_02 | AC | 71 ms
71,276 KB |
testcase_03 | AC | 72 ms
71,292 KB |
testcase_04 | AC | 72 ms
71,192 KB |
testcase_05 | AC | 72 ms
71,184 KB |
testcase_06 | AC | 72 ms
71,232 KB |
testcase_07 | AC | 72 ms
71,276 KB |
testcase_08 | AC | 72 ms
71,172 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
ソースコード
import itertools S=input() L = len(S) AB = [-1]*L for i in range(L): if S[i]=='A': AB[i] = 1 ACC = [0] + list(itertools.accumulate(AB)) ans = 0 for i in range(L+1): for j in reversed(range(i+ans,L+1)): if(ACC[i]==ACC[j] and ans < j-i): ans = j-i break print(ans)