結果
問題 | No.393 2本の竹 |
ユーザー | rlangevin |
提出日時 | 2023-11-22 19:52:10 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 638 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 81,420 KB |
最終ジャッジ日時 | 2023-11-22 19:52:14 |
合計ジャッジ時間 | 3,632 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
70,292 KB |
testcase_01 | AC | 39 ms
59,344 KB |
testcase_02 | AC | 41 ms
59,324 KB |
testcase_03 | AC | 40 ms
59,344 KB |
testcase_04 | AC | 36 ms
53,460 KB |
testcase_05 | AC | 41 ms
59,344 KB |
testcase_06 | AC | 36 ms
53,460 KB |
testcase_07 | AC | 41 ms
61,440 KB |
testcase_08 | AC | 42 ms
61,568 KB |
testcase_09 | TLE | - |
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 | -- | - |
ソースコード
import sys input = sys.stdin.readline def check(m, A, n1, n2): s = sum(A[:m]) if s > n1 + n2: return False v = 1 for a in A[:m]: v = v | (v << a) for i in range(n1 + 1): if ((v >> i) & 1) and s - i <= n2: return True return False t = int(input()) inf = 10 ** 18 for _ in range(t): n1, n2 = map(int, input().split()) m = int(input()) A = sorted(list(map(int, input().split()))) yes = 0 no = m + 1 while no - yes != 1: mid = (yes + no)//2 if check(mid, A, n1, n2): yes = mid else: no = mid print(yes)