結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー seica_at_se
提出日時 2019-12-12 00:54:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 546 ms / 2,500 ms
コード長 596 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 147,500 KB
最終ジャッジ日時 2024-06-24 08:13:00
合計ジャッジ時間 10,731 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [[0 for i in range(3003)] for j in range(3003)]

for i in range(n+1):
    for j in range(n+1):
        #print(i, j)
        if i > 0:
            dp[i][j] = max(dp[i][j], dp[i-1][j])

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

        if dp[i][j] == n:
            continue
        if i == n and j == n:
            continue
        if a[i] + b[j] >= d[dp[i][j]]:
            dp[i][j] += 1

print(dp[n][n])
0