結果

問題 No.38 赤青白ブロック
ユーザー ayaoniayaoni
提出日時 2020-12-17 02:22:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,236 ms / 5,000 ms
コード長 1,195 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 81,552 KB
実行使用メモリ 76,188 KB
最終ジャッジ日時 2023-10-20 10:30:08
合計ジャッジ時間 31,120 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,080 ms
75,460 KB
testcase_01 AC 1,053 ms
75,840 KB
testcase_02 AC 1,023 ms
75,624 KB
testcase_03 AC 1,053 ms
75,548 KB
testcase_04 AC 995 ms
75,480 KB
testcase_05 AC 1,088 ms
75,460 KB
testcase_06 AC 1,029 ms
75,912 KB
testcase_07 AC 1,020 ms
76,188 KB
testcase_08 AC 1,090 ms
75,464 KB
testcase_09 AC 1,023 ms
75,768 KB
testcase_10 AC 1,056 ms
75,424 KB
testcase_11 AC 1,236 ms
75,504 KB
testcase_12 AC 1,002 ms
75,472 KB
testcase_13 AC 1,125 ms
75,420 KB
testcase_14 AC 1,067 ms
75,632 KB
testcase_15 AC 1,104 ms
75,696 KB
testcase_16 AC 969 ms
75,900 KB
testcase_17 AC 1,021 ms
75,848 KB
testcase_18 AC 1,097 ms
75,656 KB
testcase_19 AC 1,095 ms
75,984 KB
testcase_20 AC 1,084 ms
75,852 KB
testcase_21 AC 967 ms
75,760 KB
testcase_22 AC 1,086 ms
75,716 KB
testcase_23 AC 1,061 ms
75,488 KB
testcase_24 AC 1,031 ms
75,828 KB
testcase_25 AC 1,047 ms
75,560 KB
testcase_26 AC 1,050 ms
75,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


r,b = MI()
S = S()

X = []
for i in range(30):
    if S[i] != 'W':
        X.append(i)

ans = 10
for i in range(1<<20):
    delete = []
    for j in range(20):
        if (i>>j) & 1:
            delete.append(X[j])
    delete.append(100)
    A = ''
    index = 0
    for j in range(30):
        if j != delete[index]:
            A += S[j]
        else:
            index += 1
    l = len(A)
    for j in range(l):
        if A[j] == 'W':
            continue
        elif A[j] == 'R':
            if (0 <= j-r and A[j-r] == 'R') or (j+r < l and A[j+r] == 'R'):
                break
        else:
            if (0 <= j-b and A[j-b] == 'B') or (j+b < l and A[j+b] == 'B'):
                break
    else:
        ans = max(ans,l)

print(ans)
0