結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー りあん
提出日時 2019-12-05 23:10:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 689 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 101,408 KB
最終ジャッジ日時 2024-06-24 02:37:13
合計ジャッジ時間 4,819 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = list(map(int, input().split()))

d.sort()

dp = [[0 for j in range(n + 1)] for i in range(n + 1)]
dp[0][0] = n + 1
ans = 0
for i in range(n + 1):
    k = n
    for j in range(n + 1):
        if i == 0 and j == 0:
            continue
        while k > 0 and d[k - 1] > a[i] + b[j]:
            k -= 1

        ma = -1
        if i > 0:
            ma = max(ma, dp[i - 1][j] - 1)
        if j > 0:
            ma = max(ma, dp[i][j - 1] - 1)

        dp[i][j] = min(k, ma)
        if dp[i][j] > 0:
            ans = max(ans, i + j)
        else:
            break

print(ans)
0