結果
問題 |
No.38 赤青白ブロック
|
ユーザー |
|
提出日時 | 2015-02-11 22:35:41 |
言語 | PyPy2 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 492 bytes |
コンパイル時間 | 618 ms |
コンパイル使用メモリ | 76,672 KB |
実行使用メモリ | 86,912 KB |
最終ジャッジ日時 | 2024-06-23 18:58:54 |
合計ジャッジ時間 | 7,102 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 TLE * 1 -- * 25 |
ソースコード
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