結果
問題 | No.38 赤青白ブロック |
ユーザー | roiti46 |
提出日時 | 2015-02-11 22:25:48 |
言語 | PyPy2 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 658 bytes |
コンパイル時間 | 1,702 ms |
コンパイル使用メモリ | 77,372 KB |
実行使用メモリ | 80,708 KB |
最終ジャッジ日時 | 2023-09-05 23:47:13 |
合計ジャッジ時間 | 5,423 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 199 ms
80,012 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 83 ms
76,472 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 143 ms
80,708 KB |
testcase_10 | AC | 81 ms
76,184 KB |
testcase_11 | AC | 82 ms
76,388 KB |
testcase_12 | AC | 81 ms
76,416 KB |
testcase_13 | AC | 82 ms
76,220 KB |
testcase_14 | AC | 81 ms
76,320 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 97 ms
78,836 KB |
testcase_18 | WA | - |
testcase_19 | AC | 90 ms
79,220 KB |
testcase_20 | AC | 96 ms
78,776 KB |
testcase_21 | WA | - |
testcase_22 | AC | 132 ms
80,268 KB |
testcase_23 | WA | - |
testcase_24 | AC | 122 ms
79,620 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
ソースコード
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