結果
問題 |
No.949 飲酒プログラミングコンテスト
|
ユーザー |
|
提出日時 | 2019-12-12 11:12:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 18,332 KB |
最終ジャッジ日時 | 2024-06-24 21:11:22 |
合計ジャッジ時間 | 4,929 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 TLE * 1 -- * 21 |
ソースコード
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) d = list(map(int, input().split())) a.reverse() b.reverse() d.sort() d.append(1<<30) ans = 0 dp = [0]*(n+1) for i in range(n+1): ndp = [0]*(n+1) for j in range(n+1): if i+1 <= n: ndp[j] = max(ndp[j], dp[j]+(1 if a[i+1]+b[j]>=d[dp[j]] else 0)) if j+1 <= n: dp[j+1] = max(dp[j+1], dp[j]+(1 if a[i]+b[j+1]>=d[dp[j]] else 0)) ans = max(ans, max(dp[:n+(1 if i != n else 0)])) dp = ndp print(ans)