結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 75 ms
76,288 KB
testcase_04 AC 74 ms
76,320 KB
testcase_05 AC 555 ms
78,720 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 77 ms
76,236 KB
testcase_11 AC 76 ms
76,128 KB
testcase_12 WA -
testcase_13 AC 75 ms
76,412 KB
testcase_14 WA -
testcase_15 AC 74 ms
76,300 KB
testcase_16 AC 86 ms
78,684 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 767 ms
78,652 KB
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 75 ms
76,448 KB
testcase_26 AC 88 ms
78,856 KB
testcase_27 AC 134 ms
78,716 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 782 ms
78,760 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 1,507 ms
78,732 KB
testcase_34 AC 857 ms
78,768 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 756 ms
78,724 KB
testcase_39 WA -
testcase_40 AC 1,169 ms
79,256 KB
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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