結果
| 問題 |
No.949 飲酒プログラミングコンテスト
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-12 11:11:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 458 ms / 2,500 ms |
| コード長 | 535 bytes |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 77,604 KB |
| 最終ジャッジ日時 | 2024-06-24 21:11:10 |
| 合計ジャッジ時間 | 7,464 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
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)