結果

問題 No.38 赤青白ブロック
ユーザー 👑 colognecologne
提出日時 2022-01-23 18:13:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 839 ms / 5,000 ms
コード長 893 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,220 KB
実行使用メモリ 77,092 KB
最終ジャッジ日時 2023-08-19 23:47:01
合計ジャッジ時間 21,993 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 771 ms
76,780 KB
testcase_01 AC 605 ms
76,856 KB
testcase_02 AC 738 ms
76,788 KB
testcase_03 AC 762 ms
76,876 KB
testcase_04 AC 592 ms
76,848 KB
testcase_05 AC 783 ms
77,092 KB
testcase_06 AC 708 ms
76,888 KB
testcase_07 AC 610 ms
76,856 KB
testcase_08 AC 783 ms
76,704 KB
testcase_09 AC 723 ms
76,820 KB
testcase_10 AC 804 ms
76,704 KB
testcase_11 AC 831 ms
77,048 KB
testcase_12 AC 740 ms
76,844 KB
testcase_13 AC 839 ms
76,796 KB
testcase_14 AC 711 ms
76,828 KB
testcase_15 AC 819 ms
76,720 KB
testcase_16 AC 413 ms
76,740 KB
testcase_17 AC 671 ms
76,792 KB
testcase_18 AC 774 ms
76,912 KB
testcase_19 AC 746 ms
77,004 KB
testcase_20 AC 624 ms
77,024 KB
testcase_21 AC 631 ms
76,848 KB
testcase_22 AC 614 ms
76,840 KB
testcase_23 AC 818 ms
76,672 KB
testcase_24 AC 507 ms
76,776 KB
testcase_25 AC 806 ms
76,720 KB
testcase_26 AC 753 ms
76,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    Kr, Kb = map(int, input().split())
    s = input()
    ans = 10
    for rm in range(1024):
        for bm in range(1024):
            ns = ''
            rc, bc = 0, 0
            for i in s:
                if i == 'R':
                    if (1 << rc) & rm:
                        ns += 'R'
                        if len(ns) > Kr and ns[-Kr-1] == 'R':
                            break
                    rc += 1
                elif i == 'B':
                    if (1 << bc) & bm:
                        ns += 'B'
                        if len(ns) > Kb and ns[-Kb-1] == 'B':
                            break
                    bc += 1
                else:
                    ns += 'W'
            else:
                ans = max(ans, len(ns))

    print(ans)


if __name__ == '__main__':
    main()
0