結果

問題 No.38 赤青白ブロック
ユーザー roiti46roiti46
提出日時 2015-02-11 22:35:41
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 492 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 77,788 KB
実行使用メモリ 87,364 KB
最終ジャッジ日時 2023-09-05 23:48:13
合計ジャッジ時間 7,080 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from itertools import combinations
def judge(s):
    if any(s[i] == s[i-Kr] == "R" for i in range(Kr,len(s))): return False
    if any(s[i] == s[i-Kb] == "B" for i in range(Kb,len(s))): return False
    return True

def rec(s):
    global ans
    if len(s) <= ans: return
    if judge(s):
        ans = len(s)
        return
    for i in range(len(s)):
        if s[i] == "W": continue
        rec(s[:i]+s[i+1:])

Kr,Kb = map(int,raw_input().split())
S = raw_input()
ans = 12
rec(S)
print ans
0