結果

問題 No.38 赤青白ブロック
ユーザー ytftytft
提出日時 2022-11-04 22:50:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 898 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 78,188 KB
最終ジャッジ日時 2023-09-26 01:20:15
合計ジャッジ時間 20,911 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 590 ms
77,928 KB
testcase_01 AC 842 ms
77,068 KB
testcase_02 AC 840 ms
77,268 KB
testcase_03 AC 697 ms
77,072 KB
testcase_04 AC 673 ms
77,256 KB
testcase_05 AC 587 ms
78,188 KB
testcase_06 AC 821 ms
77,268 KB
testcase_07 AC 795 ms
77,236 KB
testcase_08 AC 578 ms
77,824 KB
testcase_09 AC 753 ms
76,880 KB
testcase_10 AC 554 ms
77,752 KB
testcase_11 AC 556 ms
77,660 KB
testcase_12 AC 644 ms
77,268 KB
testcase_13 AC 563 ms
77,800 KB
testcase_14 AC 654 ms
77,348 KB
testcase_15 AC 604 ms
77,616 KB
testcase_16 AC 796 ms
77,164 KB
testcase_17 AC 657 ms
77,304 KB
testcase_18 AC 611 ms
77,792 KB
testcase_19 AC 592 ms
76,948 KB
testcase_20 AC 705 ms
77,108 KB
testcase_21 AC 709 ms
77,316 KB
testcase_22 AC 739 ms
77,424 KB
testcase_23 AC 566 ms
77,748 KB
testcase_24 AC 898 ms
77,216 KB
testcase_25 AC 621 ms
77,568 KB
testcase_26 AC 646 ms
77,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda:sys.stdin.readline().rstrip()
K=list(map(int,input().split()))
S=[['R','B','W'].index(i) for i in input()]
ans=0
for i in range(2**20):
	temp=i
	cur=[]
	for j in S:
		if j==2 or temp%2:
			cur.append(j)
		if j<2:
			temp//=2
	flg=1
	for j in range(2):
		for k in range(len(cur)-K[j]):
			if cur[k]==cur[k+K[j]]==j:
				flg=0
	ans=max(ans,len(cur)*flg)
print(ans)
0