結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー seica_at_seseica_at_se
提出日時 2019-12-12 00:54:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 515 ms / 2,500 ms
コード長 596 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 149,224 KB
最終ジャッジ日時 2023-09-06 13:39:36
合計ジャッジ時間 10,674 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
134,148 KB
testcase_01 AC 159 ms
133,980 KB
testcase_02 AC 152 ms
133,924 KB
testcase_03 AC 146 ms
134,016 KB
testcase_04 AC 140 ms
134,064 KB
testcase_05 AC 151 ms
134,256 KB
testcase_06 AC 151 ms
134,380 KB
testcase_07 AC 156 ms
134,452 KB
testcase_08 AC 175 ms
148,204 KB
testcase_09 AC 155 ms
134,372 KB
testcase_10 AC 152 ms
134,476 KB
testcase_11 AC 356 ms
148,716 KB
testcase_12 AC 364 ms
148,548 KB
testcase_13 AC 324 ms
148,452 KB
testcase_14 AC 205 ms
148,360 KB
testcase_15 AC 279 ms
148,344 KB
testcase_16 AC 350 ms
148,540 KB
testcase_17 AC 221 ms
148,360 KB
testcase_18 AC 489 ms
149,212 KB
testcase_19 AC 314 ms
148,560 KB
testcase_20 AC 202 ms
148,504 KB
testcase_21 AC 174 ms
148,296 KB
testcase_22 AC 195 ms
148,428 KB
testcase_23 AC 159 ms
134,296 KB
testcase_24 AC 372 ms
148,660 KB
testcase_25 AC 451 ms
148,452 KB
testcase_26 AC 472 ms
148,276 KB
testcase_27 AC 381 ms
148,632 KB
testcase_28 AC 515 ms
149,224 KB
testcase_29 AC 371 ms
148,672 KB
testcase_30 AC 343 ms
148,488 KB
testcase_31 AC 327 ms
148,756 KB
testcase_32 AC 417 ms
148,324 KB
権限があれば一括ダウンロードができます

ソースコード

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