結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー H3PO4H3PO4
提出日時 2021-07-18 09:35:02
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 682 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 392,716 KB
最終ジャッジ日時 2023-09-22 10:37:45
合計ジャッジ時間 33,155 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,304 KB
testcase_01 AC 77 ms
71,288 KB
testcase_02 AC 77 ms
71,268 KB
testcase_03 AC 81 ms
71,348 KB
testcase_04 AC 81 ms
75,536 KB
testcase_05 AC 89 ms
75,836 KB
testcase_06 AC 85 ms
75,828 KB
testcase_07 AC 84 ms
75,864 KB
testcase_08 AC 111 ms
77,616 KB
testcase_09 AC 92 ms
76,252 KB
testcase_10 AC 91 ms
76,372 KB
testcase_11 AC 1,644 ms
316,712 KB
testcase_12 AC 1,366 ms
324,244 KB
testcase_13 AC 1,236 ms
316,700 KB
testcase_14 AC 228 ms
102,372 KB
testcase_15 AC 1,228 ms
307,260 KB
testcase_16 AC 2,420 ms
334,136 KB
testcase_17 AC 168 ms
94,644 KB
testcase_18 AC 1,642 ms
392,716 KB
testcase_19 AC 1,635 ms
309,736 KB
testcase_20 AC 476 ms
159,916 KB
testcase_21 AC 144 ms
83,088 KB
testcase_22 AC 222 ms
112,636 KB
testcase_23 AC 96 ms
76,416 KB
testcase_24 AC 856 ms
317,380 KB
testcase_25 AC 2,190 ms
358,892 KB
testcase_26 AC 1,995 ms
358,252 KB
testcase_27 TLE -
testcase_28 AC 1,480 ms
358,436 KB
testcase_29 AC 2,168 ms
346,268 KB
testcase_30 AC 1,687 ms
356,532 KB
testcase_31 AC 1,412 ms
353,880 KB
testcase_32 AC 2,498 ms
316,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
D = sorted(map(int, input().split()))


def isOK(x):
    dp = [[False] * (N + 1) for _ in range(N + 1)]
    dp[0][0] = True
    for a in range(N + 1):
        for b in range(x - a + 1):
            if a == b == 0:
                continue
            if A[a] + B[b] >= D[x - a - b]:
                if (a and dp[a - 1][b]) or (b and dp[a][b - 1]):
                    dp[a][b] = True
                    if a + b == x:
                        return True
    return False


l, r = 0, N + 1
while r - l > 1:
    m = (r + l) // 2
    if isOK(m):
        l = m
    else:
        r = m
print(l)
0