結果

問題 No.38 赤青白ブロック
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-24 14:23:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,068 ms / 5,000 ms
コード長 581 bytes
コンパイル時間 1,240 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 77,808 KB
最終ジャッジ日時 2023-08-30 21:51:16
合計ジャッジ時間 28,893 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,047 ms
77,508 KB
testcase_01 AC 954 ms
77,088 KB
testcase_02 AC 937 ms
77,180 KB
testcase_03 AC 944 ms
77,112 KB
testcase_04 AC 897 ms
77,384 KB
testcase_05 AC 1,068 ms
77,420 KB
testcase_06 AC 905 ms
77,192 KB
testcase_07 AC 828 ms
77,188 KB
testcase_08 AC 1,048 ms
77,500 KB
testcase_09 AC 903 ms
77,148 KB
testcase_10 AC 1,014 ms
76,956 KB
testcase_11 AC 1,054 ms
77,552 KB
testcase_12 AC 938 ms
77,332 KB
testcase_13 AC 1,011 ms
77,392 KB
testcase_14 AC 949 ms
77,100 KB
testcase_15 AC 1,001 ms
77,216 KB
testcase_16 AC 797 ms
76,976 KB
testcase_17 AC 933 ms
77,124 KB
testcase_18 AC 1,068 ms
77,808 KB
testcase_19 AC 941 ms
77,284 KB
testcase_20 AC 945 ms
77,252 KB
testcase_21 AC 873 ms
77,348 KB
testcase_22 AC 948 ms
76,988 KB
testcase_23 AC 1,014 ms
77,544 KB
testcase_24 AC 816 ms
76,864 KB
testcase_25 AC 980 ms
77,748 KB
testcase_26 AC 952 ms
77,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

r, b = map(int, input().split())
S = input()

ans = 10

for bit in range(1 << 20):
    i = 0
    use = []
    for s in S:
        if s == "W":
            use.append(s)
            continue
        if (bit >> i) & 1:
            use.append(s)
        i += 1

    ok = True
    for i, s in enumerate(use):
        if s == "R" and i + r < len(use) and use[i + r] == "R":
            ok = False
            break
        elif s == "B" and i + b < len(use) and use[i + b] == "B":
            ok = False
            break
    if ok and len(use) > ans:
        ans = len(use)

print(ans)
0