結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2018-05-09 14:25:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 121 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 19,540 KB |
最終ジャッジ日時 | 2024-06-28 02:41:22 |
合計ジャッジ時間 | 3,981 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 6 TLE * 1 -- * 9 |
ソースコード
S = input() dictN = {0:0} listA = [] dictMIN = {} mx = 0 count = 0 for a,b in enumerate(S): if b == "A": count += 1 else: count -= 1 if count in dictMIN: dictN[count] = a else: dictMIN[count] = a if not count in listA: listA.append(count) for a in listA: try: if dictN[a] - dictMIN[a] > mx: mx = dictN[a] - dictMIN[a] except KeyError: pass print(str(mx) + "\n")