結果

問題 No.38 赤青白ブロック
ユーザー nebukuro09
提出日時 2016-10-17 15:29:30
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 76,800 KB
実行使用メモリ 78,592 KB
最終ジャッジ日時 2024-11-22 13:17:01
合計ジャッジ時間 20,639 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 11
権限があれば一括ダウンロードができます

ソースコード

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+Kb] == 'B':
            return 0
    return N

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