結果
| 問題 |
No.38 赤青白ブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-11 22:25:48 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 658 bytes |
| コンパイル時間 | 706 ms |
| コンパイル使用メモリ | 76,716 KB |
| 実行使用メモリ | 78,764 KB |
| 最終ジャッジ日時 | 2024-06-23 18:58:20 |
| 合計ジャッジ時間 | 3,962 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 14 |
ソースコード
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 s in used: return
used.add(s)
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()
used = set([])
ans = 12
rec(S)
print ans