結果

問題 No.50 おもちゃ箱
ユーザー ytft
提出日時 2022-11-06 01:20:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-07-19 18:05:52
合計ジャッジ時間 26,038 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 24 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,itertools
input=lambda:sys.stdin.readline().rstrip()
N=int(input())
A=list(map(int,input().split()))
M=int(input())
B=sorted(list(map(int,input().split())))[::-1]
A=itertools.permutations(A)
ans=-1
for i in A:
	temp=[0 for i in range(M)]
	for j in i:
		for k in range(M):
			if temp[k]+j<=B[k]:
				temp[k]+=j
				break
		else:
			break
	else:
		ans=max(ans,M-temp.count(0))
print(ans)
0