結果

問題 No.50 おもちゃ箱
ユーザー roiti46roiti46
提出日時 2015-02-23 17:06:53
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 77,576 KB
実行使用メモリ 79,676 KB
最終ジャッジ日時 2023-09-06 03:19:05
合計ジャッジ時間 16,689 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 72 ms
76,164 KB
testcase_04 AC 72 ms
76,148 KB
testcase_05 AC 682 ms
79,200 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 72 ms
76,696 KB
testcase_09 WA -
testcase_10 AC 73 ms
76,392 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 72 ms
76,444 KB
testcase_16 WA -
testcase_17 AC 645 ms
78,828 KB
testcase_18 AC 115 ms
78,968 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 123 ms
79,060 KB
testcase_22 AC 705 ms
79,032 KB
testcase_23 AC 95 ms
78,420 KB
testcase_24 AC 71 ms
76,204 KB
testcase_25 AC 72 ms
76,428 KB
testcase_26 WA -
testcase_27 AC 127 ms
78,812 KB
testcase_28 WA -
testcase_29 AC 615 ms
78,960 KB
testcase_30 AC 682 ms
78,784 KB
testcase_31 AC 73 ms
76,288 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 964 ms
79,336 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 650 ms
78,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as it
N = int(raw_input())
A = map(int,raw_input().split())
M = int(raw_input())
_B = sorted(map(int,raw_input().split()),reverse = True)
ans = 100
for order in it.permutations(A,N):
    B = _B[:]
    i = j = 0
    while i < N and j < M:
        if B[j] >= A[i]:
            B[j] -= A[i]
            i += 1
        else:
            j += 1
        if i == N:
            ans = min(ans, j+1)
            break
print ans if ans < 100 else -1
    
0