結果
| 問題 | No.50 おもちゃ箱 |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2020-12-06 04:51:10 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 334 ms / 5,000 ms |
| + 204µs | |
| コード長 | 483 bytes |
| 記録 | |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 95,724 KB |
| 実行使用メモリ | 83,840 KB |
| 最終ジャッジ日時 | 2026-08-29 06:54:03 |
| 合計ジャッジ時間 | 9,552 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 38 |
ソースコード
n = int(input())
*a, = map(int,input().split())
m = int(input())
*b, = map(int,input().split())
b.sort(reverse=True)
ans = INF = 100
from itertools import permutations
for lst in permutations(a):
v = idx = 0
for ai in lst:
if v+ai > b[idx]:
v = ai
idx += 1
if idx >= m or b[idx] < ai:
idx = INF
else:
v += ai
if idx >= ans: break
ans = min(ans,idx)
print(ans+1 if ans!=INF else -1)
convexineq