結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー ttrttr
提出日時 2020-01-31 20:01:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 218,304 KB
最終ジャッジ日時 2023-10-17 08:28:08
合計ジャッジ時間 23,324 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,416 KB
testcase_01 AC 39 ms
53,416 KB
testcase_02 AC 39 ms
53,416 KB
testcase_03 AC 39 ms
53,416 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 757 ms
145,236 KB
testcase_16 AC 1,319 ms
202,672 KB
testcase_17 AC 220 ms
87,624 KB
testcase_18 AC 1,385 ms
203,560 KB
testcase_19 AC 1,184 ms
177,036 KB
testcase_20 AC 318 ms
97,048 KB
testcase_21 AC 154 ms
84,612 KB
testcase_22 AC 286 ms
92,376 KB
testcase_23 AC 79 ms
76,604 KB
testcase_24 AC 773 ms
138,916 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1,416 ms
211,444 KB
testcase_28 AC 1,402 ms
204,904 KB
testcase_29 WA -
testcase_30 AC 1,593 ms
217,616 KB
testcase_31 AC 963 ms
215,140 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

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) - 1

dp = [[N]*(N+1) for _ in range(N+1)]
for i in range(N):
    for j in range(N):
        if i+j >= N:
            continue
        dp[i+1][j] = min(L[i+1][j], dp[i][j]-1, dp[i+1][j])
        dp[i][j+1] = min(L[i][j+1], dp[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