結果

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

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]

d.sort()
n1 = n+1
es = [[] for i in range(n1)]
for i in range(n1):
    for j in range(n1):
        p = i + j
        if p <= n:
            es[p].append(i*n1+j)

m = [0] * (n1*n1)
for p in range(n,0,-1):
    for e in es[p]:
        i = e // n1
        j = e % n1
        s = m[e]
        r = a[i] + b[j]
        if s < n and d[s] <= r:
            s += 1
        u = e - 1
        if u >= 0 and s > m[u]:
            m[u] = s
        v = e - n1
        if v >= 0 and s > m[v]:
            m[v] = s
        
print(m[0])
0