結果
| 問題 |
No.50 おもちゃ箱
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-05 14:00:38 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,415 ms / 5,000 ms |
| コード長 | 396 bytes |
| コンパイル時間 | 1,701 ms |
| コンパイル使用メモリ | 76,544 KB |
| 実行使用メモリ | 77,868 KB |
| 最終ジャッジ日時 | 2024-06-25 21:36:33 |
| 合計ジャッジ時間 | 19,096 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 38 |
ソースコード
#coding: utf-8 #yuki50 from itertools import permutations n=int(raw_input()) a=map(int,raw_input().split()) m=int(raw_input()) b=map(int,raw_input().split()) a.sort() b.sort() b.reverse() res=m+1 for perm in permutations(a,n): temp=b[:] i,j=0,0 while i<n and j<m: if temp[j]>=perm[i]: temp[j]-=perm[i] i+=1 else: j+=1 res=min(res,j+1) if res<m+1: print res else: print -1