結果
問題 | No.672 最長AB列 |
ユーザー | hang_hang_cln |
提出日時 | 2018-05-07 21:29:15 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 109 ms |
コンパイル使用メモリ | 10,604 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2023-09-10 10:57:09 |
合計ジャッジ時間 | 4,069 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
12,272 KB |
testcase_01 | AC | 16 ms
7,772 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | AC | 16 ms
7,824 KB |
testcase_05 | AC | 16 ms
7,820 KB |
testcase_06 | AC | 15 ms
7,768 KB |
testcase_07 | AC | 15 ms
7,864 KB |
testcase_08 | AC | 15 ms
7,908 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
ソースコード
S = input() if len(S) < 2: print('0') else: maxCutLength = 0 for cutLength in range(2,len(S)+1): for startIndex in range(0,len(S)-cutLength+1): if S[startIndex:startIndex+cutLength].count('A') == S[startIndex:startIndex+cutLength].count('B'): if cutLength > maxCutLength: maxCutLength = cutLength print (maxCutLength)