結果
問題 |
No.38 赤青白ブロック
|
ユーザー |
|
提出日時 | 2015-02-11 22:23:27 |
言語 | PyPy2 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 608 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 76,792 KB |
実行使用メモリ | 89,532 KB |
最終ジャッジ日時 | 2024-06-23 18:54:21 |
合計ジャッジ時間 | 6,771 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 1 TLE * 1 -- * 25 |
ソースコード
from itertools import combinations def judge(s): for i in range(Kr,len(s)-Kr): if s[i] == s[i+Kr] == "R": return False if s[i] == s[i-Kr] == "R": return False for i in range(Kb,len(s)-Kb): if s[i] == s[i+Kb] == "B": return False if s[i] == s[i-Kb] == "B": 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 = list(raw_input()) ans = 12 rec(S) print ans