結果
| 問題 |
No.949 飲酒プログラミングコンテスト
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-18 09:35:02 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 682 bytes |
| コンパイル時間 | 120 ms |
| コンパイル使用メモリ | 82,348 KB |
| 実行使用メモリ | 366,628 KB |
| 最終ジャッジ日時 | 2024-07-08 02:31:46 |
| 合計ジャッジ時間 | 28,614 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 TLE * 1 |
ソースコード
N = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
D = sorted(map(int, input().split()))
def isOK(x):
dp = [[False] * (N + 1) for _ in range(N + 1)]
dp[0][0] = True
for a in range(N + 1):
for b in range(x - a + 1):
if a == b == 0:
continue
if A[a] + B[b] >= D[x - a - b]:
if (a and dp[a - 1][b]) or (b and dp[a][b - 1]):
dp[a][b] = True
if a + b == x:
return True
return False
l, r = 0, N + 1
while r - l > 1:
m = (r + l) // 2
if isOK(m):
l = m
else:
r = m
print(l)