結果
| 問題 |
No.38 赤青白ブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-17 15:30:39 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 2,383 ms |
| コンパイル使用メモリ | 76,716 KB |
| 実行使用メモリ | 79,136 KB |
| 最終ジャッジ日時 | 2024-11-22 13:17:57 |
| 合計ジャッジ時間 | 22,400 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 11 |
ソースコード
Kr, Kb = map(int, raw_input().split())
S = raw_input()
C = S.count('R') + S.count('B')
def solve(b):
newS = ''
for i, s in enumerate(S):
if s != 'W' and (1<<i & b):
continue
newS += s
N = len(newS)
for i in xrange(N-Kr):
if newS[i] == 'R' and newS[i+Kr] == 'R':
return 0
for i in xrange(N-Kb):
if newS[i] == 'B' and newS[i+Kb] == 'B':
return 0
return N
ans = S.count('W')
for b in xrange(1<<C):
ans = max(solve(b), ans)
print ans