結果
問題 | No.38 赤青白ブロック |
ユーザー | ckawatak |
提出日時 | 2019-03-03 22:46:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,000 ms / 5,000 ms |
コード長 | 747 bytes |
コンパイル時間 | 277 ms |
コンパイル使用メモリ | 87,096 KB |
実行使用メモリ | 77,840 KB |
最終ジャッジ日時 | 2023-09-05 17:50:35 |
合計ジャッジ時間 | 25,870 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 862 ms
77,132 KB |
testcase_01 | AC | 922 ms
77,532 KB |
testcase_02 | AC | 1,000 ms
77,428 KB |
testcase_03 | AC | 879 ms
77,228 KB |
testcase_04 | AC | 899 ms
77,288 KB |
testcase_05 | AC | 824 ms
77,272 KB |
testcase_06 | AC | 864 ms
77,684 KB |
testcase_07 | AC | 844 ms
77,840 KB |
testcase_08 | AC | 861 ms
77,328 KB |
testcase_09 | AC | 833 ms
77,640 KB |
testcase_10 | AC | 825 ms
77,092 KB |
testcase_11 | AC | 825 ms
77,252 KB |
testcase_12 | AC | 994 ms
77,356 KB |
testcase_13 | AC | 837 ms
77,220 KB |
testcase_14 | AC | 986 ms
76,984 KB |
testcase_15 | AC | 804 ms
77,436 KB |
testcase_16 | AC | 908 ms
77,652 KB |
testcase_17 | AC | 888 ms
77,580 KB |
testcase_18 | AC | 811 ms
77,432 KB |
testcase_19 | AC | 825 ms
77,740 KB |
testcase_20 | AC | 913 ms
77,504 KB |
testcase_21 | AC | 866 ms
77,636 KB |
testcase_22 | AC | 832 ms
77,416 KB |
testcase_23 | AC | 866 ms
77,368 KB |
testcase_24 | AC | 912 ms
77,592 KB |
testcase_25 | AC | 891 ms
77,392 KB |
testcase_26 | AC | 822 ms
77,380 KB |
ソースコード
KR,KB = list(map(int, input().split(' '))) S = input() position = [0 for _ in range(len(S))] p = 0 for i in range(len(S)): if S[i] == 'W': position[i] = 21 else: position[i] = p p = p + 1 length = 0 # check the removal patterns of 2**20 for i in range(1<<20): t = [] yes = True for j in range(len(S)): # remove the character at position[j] and check the condition if i & (1 << position[j]) == 0: t.append(S[j]) if S[j] == 'R' and KR < len(t) and t[len(t)-KR-1] == 'R': yes = False if S[j] == 'B' and KB < len(t) and t[len(t)-KB-1] == 'B': yes = False if yes: length = max(length, len(t)) print(length)