結果
| 問題 |
No.38 赤青白ブロック
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-04-12 03:23:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 919 ms / 5,000 ms |
| コード長 | 529 bytes |
| コンパイル時間 | 474 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 76,800 KB |
| 最終ジャッジ日時 | 2024-12-16 04:27:36 |
| 合計ジャッジ時間 | 23,599 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
r,b=map(int,input().split())
S=input()
def cond(A):
for i in range(len(A)):
if i+r<len(A) and A[i]==A[i+r]=="R":
return False
if i+b<len(A) and A[i]==A[i+b]=="B":
return False
return True
ANS=0
for i in range(1<<20):
A=[]
count=0
for j in range(len(S)):
if S[j]=="W":
A.append("W")
else:
if (1<<count) & i != 0 :
A.append(S[j])
count+=1
if cond(A)==True:
ANS=max(ANS,len(A))
print(ANS)
titia