結果

問題 No.949 飲酒プログラミングコンテスト
コンテスト
ユーザー りあん
提出日時 2019-12-05 23:10:56
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 689 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,107 ms
コンパイル使用メモリ 20,672 KB
実行使用メモリ 214,556 KB
最終ジャッジ日時 2026-03-09 20:35:36
合計ジャッジ時間 66,223 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 TLE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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