結果

問題 No.50 おもちゃ箱
ユーザー ckawatakckawatak
提出日時 2019-01-14 17:24:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 609 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 71,640 KB
最終ジャッジ日時 2023-09-03 19:29:28
合計ジャッジ時間 6,734 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 64 ms
71,128 KB
testcase_04 AC 65 ms
71,460 KB
testcase_05 AC 65 ms
71,168 KB
testcase_06 AC 61 ms
71,112 KB
testcase_07 AC 63 ms
71,200 KB
testcase_08 AC 61 ms
71,124 KB
testcase_09 AC 63 ms
71,172 KB
testcase_10 AC 63 ms
71,516 KB
testcase_11 WA -
testcase_12 AC 64 ms
71,260 KB
testcase_13 AC 63 ms
71,116 KB
testcase_14 AC 62 ms
71,012 KB
testcase_15 AC 62 ms
71,456 KB
testcase_16 AC 62 ms
71,224 KB
testcase_17 AC 65 ms
71,500 KB
testcase_18 AC 69 ms
71,400 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 63 ms
71,480 KB
testcase_22 AC 64 ms
71,172 KB
testcase_23 AC 65 ms
71,320 KB
testcase_24 AC 64 ms
71,296 KB
testcase_25 AC 63 ms
71,196 KB
testcase_26 AC 63 ms
71,296 KB
testcase_27 AC 63 ms
71,476 KB
testcase_28 AC 67 ms
71,456 KB
testcase_29 AC 66 ms
71,416 KB
testcase_30 AC 65 ms
71,168 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 61 ms
71,052 KB
testcase_34 AC 61 ms
71,316 KB
testcase_35 WA -
testcase_36 AC 61 ms
71,196 KB
testcase_37 AC 63 ms
71,192 KB
testcase_38 AC 63 ms
71,436 KB
testcase_39 AC 68 ms
71,316 KB
testcase_40 AC 69 ms
71,432 KB
testcase_41 AC 66 ms
71,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split(' ')))
M = int(input())
B = list(map(int, input().split(' ')))

put = [0 for _ in range(N)]
used = [0 for _ in range(M)]
A = sorted(A, reverse=True)
B = sorted(B, reverse=True)

for i in range(M):
    for j in range(N):
        if put[j] == 0:
            if 0 <= B[i] - A[j]:
                B[i] = B[i] - A[j]
                put[j] = 1
                used[i] = 1
                
if sum(put) == N:
    for i in range(M):
        if (i < M-1 and used[i+1] == 0) or (i == M-1 and used[i] == 1):
            print(i+1)
            exit(0)
else:
    print(-1)
0