結果

問題 No.50 おもちゃ箱
ユーザー tnodinotnodino
提出日時 2022-02-20 18:35:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 7,980 KB
最終ジャッジ日時 2023-09-11 21:07:47
合計ジャッジ時間 3,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 16 ms
7,808 KB
testcase_04 AC 16 ms
7,844 KB
testcase_05 AC 26 ms
7,776 KB
testcase_06 AC 16 ms
7,936 KB
testcase_07 AC 16 ms
7,772 KB
testcase_08 AC 21 ms
7,776 KB
testcase_09 AC 17 ms
7,832 KB
testcase_10 AC 15 ms
7,756 KB
testcase_11 WA -
testcase_12 AC 20 ms
7,924 KB
testcase_13 AC 17 ms
7,760 KB
testcase_14 AC 16 ms
7,896 KB
testcase_15 AC 19 ms
7,760 KB
testcase_16 AC 16 ms
7,764 KB
testcase_17 AC 16 ms
7,840 KB
testcase_18 AC 16 ms
7,956 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 15 ms
7,784 KB
testcase_22 AC 15 ms
7,764 KB
testcase_23 AC 15 ms
7,796 KB
testcase_24 AC 15 ms
7,768 KB
testcase_25 AC 15 ms
7,912 KB
testcase_26 AC 15 ms
7,816 KB
testcase_27 AC 17 ms
7,812 KB
testcase_28 AC 20 ms
7,904 KB
testcase_29 AC 21 ms
7,808 KB
testcase_30 AC 21 ms
7,952 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 22 ms
7,924 KB
testcase_34 AC 25 ms
7,952 KB
testcase_35 WA -
testcase_36 AC 21 ms
7,816 KB
testcase_37 AC 21 ms
7,892 KB
testcase_38 AC 21 ms
7,776 KB
testcase_39 AC 23 ms
7,840 KB
testcase_40 AC 28 ms
7,944 KB
testcase_41 AC 23 ms
7,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
M = int(input())
B = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
ans = 100
for bit in range(1,2**M):
    C = []
    x = bit
    for i in range(M):
        if x & 1:
            C.append(B[i])
        x >>= 1
    flg = True
    for i in range(N):
        flg2 = True
        for j in range(len(C)):
            if A[i] <= C[j]:
                C[j] -= A[i]
                flg2 = False
                break
        if flg2:
            flg = False
            break
    if flg:
        ans = min(ans, len(C))
if ans == 100:
    ans = -1
print(ans)
0