結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー りあんりあん
提出日時 2019-12-05 23:01:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 497 ms / 2,500 ms
コード長 689 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 148,932 KB
最終ジャッジ日時 2023-09-06 07:52:07
合計ジャッジ時間 9,017 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,424 KB
testcase_01 AC 71 ms
71,444 KB
testcase_02 AC 70 ms
71,216 KB
testcase_03 AC 70 ms
71,252 KB
testcase_04 AC 72 ms
71,316 KB
testcase_05 AC 79 ms
75,736 KB
testcase_06 AC 78 ms
75,836 KB
testcase_07 AC 97 ms
76,800 KB
testcase_08 AC 122 ms
77,968 KB
testcase_09 AC 92 ms
76,036 KB
testcase_10 AC 87 ms
76,052 KB
testcase_11 AC 392 ms
127,556 KB
testcase_12 AC 413 ms
129,216 KB
testcase_13 AC 393 ms
122,080 KB
testcase_14 AC 129 ms
83,460 KB
testcase_15 AC 238 ms
110,648 KB
testcase_16 AC 344 ms
141,708 KB
testcase_17 AC 132 ms
85,048 KB
testcase_18 AC 377 ms
145,092 KB
testcase_19 AC 283 ms
127,812 KB
testcase_20 AC 143 ms
87,668 KB
testcase_21 AC 106 ms
81,484 KB
testcase_22 AC 124 ms
86,500 KB
testcase_23 AC 79 ms
76,052 KB
testcase_24 AC 258 ms
110,660 KB
testcase_25 AC 497 ms
148,316 KB
testcase_26 AC 486 ms
148,924 KB
testcase_27 AC 360 ms
148,156 KB
testcase_28 AC 391 ms
148,036 KB
testcase_29 AC 362 ms
148,204 KB
testcase_30 AC 271 ms
148,276 KB
testcase_31 AC 200 ms
132,108 KB
testcase_32 AC 469 ms
148,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = list(map(int, input().split()))

d.sort()

dp = [[0 for j in range(n + 1)] for i in range(n + 1)]
dp[0][0] = n + 1
ans = 0
for i in range(n + 1):
    k = n
    for j in range(n + 1):
        if i == 0 and j == 0:
            continue
        while k > 0 and d[k - 1] > a[i] + b[j]:
            k -= 1

        ma = -1
        if i > 0:
            ma = max(ma, dp[i - 1][j] - 1)
        if j > 0:
            ma = max(ma, dp[i][j - 1] - 1)

        dp[i][j] = min(k, ma)
        if dp[i][j] > 0:
            ans = max(ans, i + j)
        else:
            break

print(ans)
0