結果

問題 No.38 赤青白ブロック
ユーザー nebukuro09nebukuro09
提出日時 2016-10-17 15:28:33
言語 PyPy2
(7.3.15)
結果
RE  
実行時間 -
コード長 517 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 76,824 KB
実行使用メモリ 79,040 KB
最終ジャッジ日時 2024-05-02 03:08:18
合計ジャッジ時間 10,921 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 AC 736 ms
78,496 KB
testcase_09 RE -
testcase_10 AC 726 ms
78,080 KB
testcase_11 AC 754 ms
78,268 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 AC 757 ms
78,080 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 779 ms
78,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Kr, Kb = map(int, raw_input().split())
S = raw_input()
C = S.count('R') + S.count('B')

def solve(b):
    newS = ''
    for i, s in enumerate(S):
        if s != 'W' and (1<<i & b):
            continue
        newS += s
    N = len(newS)
    for i in xrange(N-Kr):
        if newS[i] == 'R' and newS[i+Kr] == 'R':
            return 0
    for i in xrange(N-Kb):
        if newS[i] == 'B' and newS[i+Kr] == 'B':
            return 0
    return N

ans = 0
for b in xrange(1<<C):
    ans = max(solve(b), ans)
print ans
0