結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ttrttr
提出日時 2020-01-31 20:14:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 767 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 11,920 KB
実行使用メモリ 200,452 KB
最終ジャッジ日時 2023-10-17 08:29:22
合計ジャッジ時間 5,159 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,264 KB
testcase_01 AC 32 ms
10,264 KB
testcase_02 AC 32 ms
10,264 KB
testcase_03 AC 30 ms
10,264 KB
testcase_04 AC 31 ms
10,280 KB
testcase_05 AC 36 ms
10,336 KB
testcase_06 AC 35 ms
10,320 KB
testcase_07 AC 56 ms
10,492 KB
testcase_08 AC 168 ms
11,256 KB
testcase_09 AC 70 ms
10,464 KB
testcase_10 AC 96 ms
10,728 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
D = [int(d) for d in input().split()]

D.sort()
L = [[N]*(N+1) for _ in range(N+1)]
for i in range(N+1):
    for j in range(N+1):
        if i+j > N:
            continue
        c = A[i] + B[j]
        L[i][j] = bisect.bisect_right(D, c)

dp = [[-1]*(N+1) for _ in range(N+1)]
dp[0][0] = N
for i in range(N):
    for j in range(N):
        if i+j >= N:
            continue
        dp[i+1][j] = max(dp[i+1][j], min(L[i+1][j], dp[i][j]) - 1)
        dp[i][j+1] = max(dp[i][j+1], min(L[i][j+1], dp[i][j]) - 1)

ans = 0
for i in range(N+1):
    for j in range(N+1):
        if dp[i][j] < 0 or i+j > N:
            continue
        ans = max(ans, i+j)

print(ans)
0