結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー face4face4
提出日時 2019-12-12 11:11:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 498 ms / 2,500 ms
コード長 535 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 78,596 KB
最終ジャッジ日時 2023-09-07 02:29:12
合計ジャッジ時間 9,175 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,328 KB
testcase_01 AC 73 ms
71,320 KB
testcase_02 AC 74 ms
71,248 KB
testcase_03 AC 76 ms
71,028 KB
testcase_04 AC 75 ms
71,296 KB
testcase_05 AC 113 ms
75,904 KB
testcase_06 AC 90 ms
75,932 KB
testcase_07 AC 101 ms
76,736 KB
testcase_08 AC 110 ms
77,348 KB
testcase_09 AC 103 ms
76,680 KB
testcase_10 AC 107 ms
76,768 KB
testcase_11 AC 306 ms
77,980 KB
testcase_12 AC 308 ms
78,240 KB
testcase_13 AC 282 ms
77,844 KB
testcase_14 AC 151 ms
77,876 KB
testcase_15 AC 220 ms
77,524 KB
testcase_16 AC 301 ms
78,156 KB
testcase_17 AC 173 ms
77,520 KB
testcase_18 AC 475 ms
78,596 KB
testcase_19 AC 239 ms
77,928 KB
testcase_20 AC 151 ms
77,964 KB
testcase_21 AC 119 ms
77,660 KB
testcase_22 AC 132 ms
77,864 KB
testcase_23 AC 90 ms
76,436 KB
testcase_24 AC 329 ms
77,952 KB
testcase_25 AC 380 ms
78,312 KB
testcase_26 AC 358 ms
78,264 KB
testcase_27 AC 324 ms
78,584 KB
testcase_28 AC 498 ms
78,132 KB
testcase_29 AC 296 ms
78,120 KB
testcase_30 AC 262 ms
77,988 KB
testcase_31 AC 238 ms
77,840 KB
testcase_32 AC 327 ms
78,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0