結果
問題 | No.50 おもちゃ箱 |
ユーザー | Mao-beta |
提出日時 | 2024-03-02 02:09:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,109 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 96,896 KB |
最終ジャッジ日時 | 2024-03-02 02:10:00 |
合計ジャッジ時間 | 10,832 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 45 ms
55,624 KB |
testcase_04 | AC | 45 ms
55,624 KB |
testcase_05 | AC | 48 ms
55,624 KB |
testcase_06 | AC | 198 ms
76,532 KB |
testcase_07 | AC | 44 ms
55,624 KB |
testcase_08 | AC | 45 ms
55,624 KB |
testcase_09 | AC | 44 ms
55,624 KB |
testcase_10 | AC | 45 ms
55,624 KB |
testcase_11 | AC | 52 ms
63,672 KB |
testcase_12 | AC | 45 ms
55,624 KB |
testcase_13 | AC | 45 ms
55,624 KB |
testcase_14 | AC | 77 ms
76,168 KB |
testcase_15 | AC | 44 ms
55,624 KB |
testcase_16 | WA | - |
testcase_17 | AC | 192 ms
76,532 KB |
testcase_18 | AC | 80 ms
76,164 KB |
testcase_19 | WA | - |
testcase_20 | AC | 62 ms
70,408 KB |
testcase_21 | AC | 238 ms
76,532 KB |
testcase_22 | AC | 1,388 ms
78,316 KB |
testcase_23 | AC | 45 ms
55,624 KB |
testcase_24 | AC | 45 ms
55,624 KB |
testcase_25 | AC | 44 ms
55,624 KB |
testcase_26 | AC | 45 ms
55,624 KB |
testcase_27 | AC | 45 ms
55,624 KB |
testcase_28 | TLE | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
ソースコード
import sys import math import bisect from heapq import heapify, heappop, heappush from collections import deque, defaultdict, Counter from functools import lru_cache from itertools import accumulate, combinations, permutations, product sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 MOD99 = 998244353 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() SMI = lambda: input().split() SLI = lambda: list(SMI()) EI = lambda m: [NLI() for _ in range(m)] def main(): N = NI() A = NLI() M = NI() B = NLI() B.sort(reverse=True) def dfs(case, bi): if case == (1<<N)-1: print(bi+1) exit() if bi >= M: return for i in range(N): if (case >> i) & 1: continue if A[i] > B[bi]: continue B[bi] -= A[i] dfs(case | (1<<i), bi) B[bi] += A[i] dfs(case, bi+1) dfs(0, 0) print(-1) if __name__ == "__main__": main()