結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー tktk_snsntktk_snsn
提出日時 2021-01-07 22:01:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,471 ms / 2,500 ms
コード長 769 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 148,384 KB
最終ジャッジ日時 2024-04-26 14:44:59
合計ジャッジ時間 16,846 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 38 ms
52,352 KB
testcase_03 AC 39 ms
52,096 KB
testcase_04 AC 44 ms
58,624 KB
testcase_05 AC 63 ms
67,584 KB
testcase_06 AC 57 ms
65,024 KB
testcase_07 AC 63 ms
67,712 KB
testcase_08 AC 90 ms
77,120 KB
testcase_09 AC 81 ms
75,324 KB
testcase_10 AC 64 ms
68,608 KB
testcase_11 AC 885 ms
127,356 KB
testcase_12 AC 907 ms
128,432 KB
testcase_13 AC 871 ms
122,200 KB
testcase_14 AC 175 ms
83,624 KB
testcase_15 AC 446 ms
112,068 KB
testcase_16 AC 864 ms
140,996 KB
testcase_17 AC 140 ms
84,144 KB
testcase_18 AC 1,084 ms
144,128 KB
testcase_19 AC 471 ms
127,960 KB
testcase_20 AC 158 ms
88,032 KB
testcase_21 AC 94 ms
81,140 KB
testcase_22 AC 112 ms
86,280 KB
testcase_23 AC 50 ms
62,720 KB
testcase_24 AC 529 ms
113,676 KB
testcase_25 AC 1,471 ms
147,956 KB
testcase_26 AC 1,202 ms
148,384 KB
testcase_27 AC 1,083 ms
147,980 KB
testcase_28 AC 1,137 ms
146,984 KB
testcase_29 AC 662 ms
147,840 KB
testcase_30 AC 295 ms
148,100 KB
testcase_31 AC 172 ms
147,564 KB
testcase_32 AC 1,030 ms
147,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
D = list(map(int, input().split()))
D.sort(reverse=True)

dp = [[0] * (N + 1) for _ in range(N + 1)]


def C(x):  # k問とけるか判定
    k = N - x
    solve = 1
    while k < N:
        for i in range(solve + 1):
            j = solve - i
            val = 0
            if i:
                val = max(val, dp[i-1][j] + (A[i]+B[j] >= D[k]))
            if j:
                val = max(val, dp[i][j-1] + (A[i]+B[j] >= D[k]))
            dp[i][j] = val
        solve += 1
        k += 1
    res = max(dp[i][x - i] for i in range(x + 1))
    return res == x


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