結果

問題 No.393 2本の竹
ユーザー nebukuro09nebukuro09
提出日時 2016-10-29 17:20:05
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 575 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 77,640 KB
実行使用メモリ 90,512 KB
最終ジャッジ日時 2023-08-16 06:48:08
合計ジャッジ時間 4,070 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
78,932 KB
testcase_01 AC 76 ms
76,232 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

d = input()

def rec(p, m, A, L):
    if p > m-1:
        return True
    if A[p] <= L[0]:
        L[0] -= A[p]
        if rec(p+1, m, A, L):
            return True
        L[0] += A[p]
    if A[p] <= L[1]:
        L[1] -= A[p]
        if rec(p+1, m, A, L):
            return True
        L[1] += A[p]
    return False

def solve(A, L):
    for i in xrange(len(A), -1, -1):
        if rec(0, i, A, L):
            print i
            break

for i in xrange(d):
    L = map(int, raw_input().split())
    input()
    A = sorted(map(int, raw_input().split()))
    solve(A, L)
0