結果
問題 | No.672 最長AB列 |
ユーザー | 👑 H20 |
提出日時 | 2020-11-05 12:52:15 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 284 bytes |
コンパイル時間 | 291 ms |
コンパイル使用メモリ | 87,036 KB |
実行使用メモリ | 71,664 KB |
最終ジャッジ日時 | 2023-09-29 16:52:03 |
合計ジャッジ時間 | 5,232 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,664 KB |
testcase_01 | AC | 72 ms
71,204 KB |
testcase_02 | AC | 72 ms
71,284 KB |
testcase_03 | AC | 74 ms
71,468 KB |
testcase_04 | AC | 73 ms
71,204 KB |
testcase_05 | AC | 73 ms
71,376 KB |
testcase_06 | AC | 72 ms
71,224 KB |
testcase_07 | AC | 73 ms
71,280 KB |
testcase_08 | AC | 74 ms
71,356 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 range(i+ans,L+1): if(ACC[i]==ACC[j] and ans < j-i): ans = j-i print(ans)