結果

問題 No.38 赤青白ブロック
ユーザー KudeKude
提出日時 2020-09-06 02:53:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,186 ms / 5,000 ms
コード長 859 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 78,096 KB
最終ジャッジ日時 2023-08-19 13:25:00
合計ジャッジ時間 31,083 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,115 ms
77,680 KB
testcase_01 AC 1,010 ms
77,732 KB
testcase_02 AC 977 ms
77,500 KB
testcase_03 AC 1,046 ms
77,756 KB
testcase_04 AC 974 ms
77,588 KB
testcase_05 AC 1,110 ms
78,096 KB
testcase_06 AC 959 ms
77,772 KB
testcase_07 AC 968 ms
77,912 KB
testcase_08 AC 1,101 ms
77,804 KB
testcase_09 AC 998 ms
77,616 KB
testcase_10 AC 1,134 ms
77,656 KB
testcase_11 AC 1,091 ms
78,032 KB
testcase_12 AC 995 ms
77,900 KB
testcase_13 AC 1,103 ms
77,604 KB
testcase_14 AC 1,026 ms
77,736 KB
testcase_15 AC 1,039 ms
77,760 KB
testcase_16 AC 926 ms
77,708 KB
testcase_17 AC 993 ms
77,828 KB
testcase_18 AC 1,098 ms
77,728 KB
testcase_19 AC 1,010 ms
77,912 KB
testcase_20 AC 1,040 ms
77,760 KB
testcase_21 AC 948 ms
77,468 KB
testcase_22 AC 984 ms
77,324 KB
testcase_23 AC 1,186 ms
77,788 KB
testcase_24 AC 942 ms
77,720 KB
testcase_25 AC 1,027 ms
77,704 KB
testcase_26 AC 1,056 ms
77,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

kr, kb = map(int, input().split())
s = input()
ans = 0
for br in range(1 << 10):
    for bb in range(1 << 10):
        t = []
        nxtr = 0
        nxtb = 0
        for c in s:
            if c == "W":
                t.append(c)
            elif c == "R":
                if br >> nxtr & 1:
                    t.append(c)
                nxtr += 1
            else:
                if bb >> nxtb & 1:
                    t.append(c)
                nxtb += 1
        l = len(t)
        ok = True
        for i in range(l):
            if t[i] == "R":
                if i + kr < l and t[i + kr] == "R":
                    ok = False
                    break
            elif t[i] == "B":
                if i + kb < l and t[i + kb] == "B":
                    ok = False
                    break
        if ok:
            ans = max(ans, l)
print(ans)
0