結果
| 問題 |
No.393 2本の竹
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-07 04:51:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 1,000 ms |
| コード長 | 655 bytes |
| コンパイル時間 | 220 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-10-14 11:11:46 |
| 合計ジャッジ時間 | 1,924 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
ソースコード
#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# %%
D = int(readline())
# %%
def solve():
N1, N2 = map(int, readline().split())
M = int(readline())
A = sorted(map(int, readline().split()))
dp = 1
S = 0
for n, x in enumerate(A):
dp |= dp << x
S += x
if S <= N1 or S <= N2:
continue
if S > N1 + N2:
return n
L = S - N2
R = N1
if (dp & (1 << (R + 1)) - 1) >> L:
continue
return n
return M
for _ in range(D):
print(solve())
maspy